X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstrictures.pm;h=3c3c0051861b71d17c68457db7b19636cf705904;hb=d81f898dc9b139b6af40e2b2edd1708e03ff6ad6;hp=cfb6e53bd43dbda7e5d97d7e6ce75b1753066969;hpb=dca7f1843c8109c592235fc100b4a6c60aaa87da;p=p5sagit%2Fstrictures.git diff --git a/lib/strictures.pm b/lib/strictures.pm index cfb6e53..3c3c005 100644 --- a/lib/strictures.pm +++ b/lib/strictures.pm @@ -3,20 +3,26 @@ package strictures; use strict; use warnings FATAL => 'all'; -our $VERSION = '1.001000'; # 1.1.0 +our $VERSION = '1.002000'; # 1.2.0 sub VERSION { for ($_[1]) { last unless defined && !ref && int != 1; die "Major version specified as $_ - this is strictures version 1"; } + # disable this since Foo->VERSION(undef) correctly returns the version + # and that can happen either if our caller passes undef explicitly or + # because the for above autovivified $_[1] - I could make it stop but + # it's pointless since we don't want to blow up if the caller does + # something valid either. + no warnings 'uninitialized'; shift->SUPER::VERSION(@_); } sub import { strict->import; warnings->import(FATAL => 'all'); - my $do_indirect = do { + my $extra_tests = do { if (exists $ENV{PERL_STRICTURES_EXTRA}) { $ENV{PERL_STRICTURES_EXTRA} } else { @@ -24,11 +30,26 @@ sub import { and (-e '.git' or -e '.svn')) } }; - if ($do_indirect) { - if (eval { require indirect; 1 }) { + if ($extra_tests) { + if (eval { + require indirect; + require multidimensional; + require bareword::filehandles; + 1 + }) { indirect->unimport(':fatal'); + multidimensional->unimport; + bareword::filehandles->unimport; } else { - die "strictures.pm extra testing active but couldn't load indirect.pm: $@"; + die "strictures.pm extra testing active but couldn't load modules. +Extra testing is auto-enabled in checkouts only, so if you're the author +of a strictures using module you need to run: + + cpan indirect multidimensional bareword::filehandles + +but these modules are not required by your users. + +Error loading modules was: $@"; } } } @@ -64,11 +85,16 @@ is equivalent to use strict; use warnings FATAL => 'all'; no indirect 'fatal'; + no multidimensional; + no bareword::filehandles; Note that _EXTRA may at some point add even more tests, with only a minor version increase, but any changes to the effect of 'use strictures' in normal mode will involve a major version bump. +Be aware: THIS MEANS THE EXTRA TEST MODULES ARE REQUIRED FOR AUTHORS OF +STRICTURES USING CODE - but not by end users thereof. + =head1 DESCRIPTION I've been writing the equivalent of this module at the top of my code for @@ -135,7 +161,7 @@ Gitweb is on http://git.shadowcat.co.uk/ and the clone URL is: =head1 AUTHOR -Matt S. Trout +mst - Matt S. Trout (cpan:MSTROUT) =head1 CONTRIBUTORS