From: Marius Gavrilescu Date: Sat, 22 Feb 2014 14:45:15 +0000 (+0200) Subject: Make Gruntmaster::Page::Base also act as strict/warnings/feature/etc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=5c6aea9392c11422abe85788aac0f62ad3a4dd14;p=gruntmaster-page.git Make Gruntmaster::Page::Base also act as strict/warnings/feature/etc --- diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index 475be80..cffb656 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -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; diff --git a/lib/Gruntmaster/Page/CSS.pm b/lib/Gruntmaster/Page/CSS.pm index 7165c3a..912e948 100644 --- a/lib/Gruntmaster/Page/CSS.pm +++ b/lib/Gruntmaster/Page/CSS.pm @@ -1,13 +1,6 @@ package Gruntmaster::Page::CSS; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; - -use File::Slurp qw/read_file/; use CSS::Minifier::XS qw/minify/; sub generate{ diff --git a/lib/Gruntmaster/Page/Generic.pm b/lib/Gruntmaster/Page/Generic.pm index 37e7931..9e097c0 100644 --- a/lib/Gruntmaster/Page/Generic.pm +++ b/lib/Gruntmaster/Page/Generic.pm @@ -3,12 +3,11 @@ package Gruntmaster::Page::Generic; use 5.014000; use strict; use warnings; +our $VERSION = '0.001'; use Gruntmaster::Data; use Gruntmaster::Page::Base; -use JSON qw/decode_json/; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; +use JSON qw/encode_json decode_json/; sub hgetall { my $hash = shift; @@ -28,7 +27,7 @@ sub makepkg { return if $INC{"$fn.pm"}; $INC{"$fn.pm"} = 1; Gruntmaster::Page::Base->import_to($pkg, $id, $title); - putsym "${pkg}::ISA", ['Gruntmaster::Page::Base']; + 1 } sub make_generate { diff --git a/lib/Gruntmaster/Page/JS.pm b/lib/Gruntmaster/Page/JS.pm index fbaf3da..f51000e 100644 --- a/lib/Gruntmaster/Page/JS.pm +++ b/lib/Gruntmaster/Page/JS.pm @@ -1,13 +1,6 @@ package Gruntmaster::Page::JS; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; - -use File::Slurp qw/read_file/; use JavaScript::Minifier::XS qw/minify/; sub generate{ diff --git a/lib/Gruntmaster/Page/Log.pm b/lib/Gruntmaster/Page/Log.pm index 68f45fd..7fe8885 100644 --- a/lib/Gruntmaster/Page/Log.pm +++ b/lib/Gruntmaster/Page/Log.pm @@ -1,11 +1,6 @@ package Gruntmaster::Page::Log; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base log => 'Job log'; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; use constant PAGE_SIZE => 10; diff --git a/lib/Gruntmaster/Page/Passwd.pm b/lib/Gruntmaster/Page/Passwd.pm index 73b7680..3a7522e 100644 --- a/lib/Gruntmaster/Page/Passwd.pm +++ b/lib/Gruntmaster/Page/Passwd.pm @@ -1,14 +1,7 @@ package Gruntmaster::Page::Passwd; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; - use Apache2::Authen::Passphrase qw/pwcheck pwset/; -use Plack::Request; sub generate{ my ($self, $format, $env) = @_; diff --git a/lib/Gruntmaster/Page/Pb/Entry.pm b/lib/Gruntmaster/Page/Pb/Entry.pm index 4cf007e..f03fe7a 100644 --- a/lib/Gruntmaster/Page/Pb/Entry.pm +++ b/lib/Gruntmaster/Page/Pb/Entry.pm @@ -1,11 +1,6 @@ package Gruntmaster::Page::Pb::Entry; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base pb_entry => ''; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; use constant FORMATS => [qw/C CPP JAVA PERL PYTHON/]; diff --git a/lib/Gruntmaster/Page/Register.pm b/lib/Gruntmaster/Page/Register.pm index 5a3edd1..be1d4be 100644 --- a/lib/Gruntmaster/Page/Register.pm +++ b/lib/Gruntmaster/Page/Register.pm @@ -1,14 +1,7 @@ package Gruntmaster::Page::Register; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; - use Apache2::Authen::Passphrase qw/pwcheck pwset USER_REGEX/; -use Plack::Request; sub generate{ my ($self, $format, $env) = @_; diff --git a/lib/Gruntmaster/Page/Src.pm b/lib/Gruntmaster/Page/Src.pm index 6dd5a9c..8f9ab1b 100644 --- a/lib/Gruntmaster/Page/Src.pm +++ b/lib/Gruntmaster/Page/Src.pm @@ -1,11 +1,6 @@ package Gruntmaster::Page::Src; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; use constant CONTENT_TYPES => +{ c => 'text/x-csrc', diff --git a/lib/Gruntmaster/Page/St.pm b/lib/Gruntmaster/Page/St.pm index 5e256b1..3857c1a 100644 --- a/lib/Gruntmaster/Page/St.pm +++ b/lib/Gruntmaster/Page/St.pm @@ -1,11 +1,6 @@ package Gruntmaster::Page::St; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base st => 'Standings'; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; use constant LEVEL_VALUES => { beginner => 100, diff --git a/lib/Gruntmaster/Page/Submit.pm b/lib/Gruntmaster/Page/Submit.pm index 2c9fef0..e537765 100644 --- a/lib/Gruntmaster/Page/Submit.pm +++ b/lib/Gruntmaster/Page/Submit.pm @@ -1,15 +1,6 @@ package Gruntmaster::Page::Submit; -use 5.014000; -use strict; -use warnings; use Gruntmaster::Page::Base; -our @ISA = qw/Gruntmaster::Page::Base/; -our $VERSION = '0.001'; - -use Apache2::Authen::Passphrase qw/pwcheck pwset USER_REGEX/; -use File::Slurp qw/read_file/; -use Plack::Request; use constant FORMAT_EXTENSION => { C => 'c',