]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Base.pm
Make Gruntmaster::Page::Base also act as strict/warnings/feature/etc
[gruntmaster-page.git] / lib / Gruntmaster / Page / Base.pm
index 6ced6145a68eff7367d87293f4963258fa861985..cffb656564e21c835ede46c38866335c3e21e52f 100644 (file)
@@ -3,6 +3,7 @@ package Gruntmaster::Page::Base;
 use 5.014000;
 use strict;
 use warnings;
+our $VERSION = '0.001';
 
 use File::Slurp qw/read_file/;
 use HTML::Template::Compiled;
@@ -34,6 +35,8 @@ use POSIX ();
 use Gruntmaster::Data ();
 use List::Util ();
 use LWP::UserAgent;
+use Plack::Request ();
+use feature ();
 
 my $ua = LWP::UserAgent->new;
 my %templates;
@@ -43,10 +46,16 @@ use Carp qw/cluck/;
 sub import_to {
        my ($self, $caller, $name, $title) = @_;
 
+       strict->import;
+       feature->import(':5.14');
+       warnings->import;
+       File::Slurp->export_to_level(1, $caller, qw/read_file/);
        Gruntmaster::Data->export_to_level(1, $caller);
        List::Util->export_to_level(1, $caller, qw/sum/);
 
        no strict 'refs';
+       *{"${caller}::ISA"} = [__PACKAGE__];
+       *{"${caller}::VERSION"} = $VERSION;
        *{"${caller}::strftime"} = \&POSIX::strftime;
        *{"${caller}::debug"} = sub {
                local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
@@ -92,6 +101,7 @@ sub vary { '' }
 sub max_age { 60 }
 
 sub variants {
+       return [] unless exists $templates{$_[0]};
        [ map { [ $_, 1, 'text/html', undef, undef, $_, undef ]} keys $templates{$_[0]} ]
 }
 
This page took 0.0231 seconds and 4 git commands to generate.