X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FBase.pm;h=e8434ef5424cd6acda980ed1e9c11c0b5b7acc9a;hb=05ebc75e25f02d68373483efa678424a4fdfa3f8;hp=1741b30c5cdfbd483cd56b7531da63ce51f699bb;hpb=dfe9fad19b62489af03cdd2fd29cc5057536b483;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index 1741b30..e8434ef 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -13,6 +13,9 @@ use HTML::Template::Compiled; use POSIX (); use Gruntmaster::Data (); use List::Util (); +use LWP::UserAgent; + +my $ua = LWP::UserAgent->new; sub import { my $caller = caller; @@ -27,7 +30,13 @@ sub import { *{"${caller}::TITLE"} = sub () { $title }; *{"${caller}::debug"} = sub { local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1; - $_[0]->({qw/level debug message/ => $_[1]}) + $_[0]->{'psgix.logger'}->({qw/level debug message/ => $_[1]}) + }; + *{"${caller}::reply"} = sub { [200, ['Content-Type' => 'text/plain'], [ @_ ] ] }; + *{"${caller}::purge"} = sub { + return unless $ENV{PURGE_HOST}; + my $req = HTTP::Request->new(PURGE => "http://$ENV{PURGE_HOST}$_[0]"); + $ua->request($req) }; } @@ -52,7 +61,7 @@ my %orig_header_templates = (