X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FBase.pm;h=9622d2ae621849d2f7be00e8c673953f2e09cd6c;hb=ab28c7bc7c201406bfc1c5d6319b26af92c7b953;hp=b0b4c57fbac3cd784fa6bc32690ff44867697567;hpb=d1a026f7f722aa6223a256936420096eb221b2dd;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index b0b4c57..9622d2a 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -12,6 +12,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; @@ -24,6 +27,16 @@ sub import { *{"${caller}::strftime"} = \&POSIX::strftime; *{"${caller}::NAME"} = sub () { $name }; *{"${caller}::TITLE"} = sub () { $title }; + *{"${caller}::debug"} = sub { + local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 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) + }; } ################################################## @@ -32,24 +45,59 @@ my %orig_header_templates = ( en => <<'HTML', TITLE_GOES_HERE - - - - - - -
iEval
-
TITLE_GOES_HERE
- - - + + + + + + + +
+ +

TITLE_GOES_HERE

+
+ +
HTML ); my %orig_footer_templates = ( en => <<'HTML', +
+
+ +
+