X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstrictures.pm;h=c5aca4b6c25ffabb32f7a3d0b7c196bb10f27b2a;hb=13bd22bfb0dae7baaad601cd573452fad11743b1;hp=3286a541fabd99fe213e417b02164957178648b9;hpb=f0be0be50f9e06745667def6c413c2131888248f;p=p5sagit%2Fstrictures.git diff --git a/lib/strictures.pm b/lib/strictures.pm index 3286a54..c5aca4b 100644 --- a/lib/strictures.pm +++ b/lib/strictures.pm @@ -3,7 +3,9 @@ package strictures; use strict; use warnings FATAL => 'all'; -our $VERSION = '1.002000'; # 1.2.0 +use constant _PERL_LT_5_8_4 => ($] < 5.008004) ? 1 : 0; + +our $VERSION = '1.003000'; # 1.3.0 sub VERSION { for ($_[1]) { @@ -19,37 +21,55 @@ sub VERSION { shift->SUPER::VERSION(@_); } +my $extras_load_warned; + sub import { strict->import; warnings->import(FATAL => 'all'); + my $extra_tests = do { if (exists $ENV{PERL_STRICTURES_EXTRA}) { - $ENV{PERL_STRICTURES_EXTRA} - } else { - !!($0 =~ /^x?t\/.*(?:load|compile|coverage|use_ok).*\.t$/ + if (_PERL_LT_5_8_4 and $ENV{PERL_STRICTURES_EXTRA}) { + die 'PERL_STRICTUTRES_EXTRA checks are not available on perls older than 5.8.4, ' + . "please unset \$ENV{PERL_STRICTURES_EXTRA}\n"; + } + $ENV{PERL_STRICTURES_EXTRA}; + } elsif (! _PERL_LT_5_8_4) { + !!($0 =~ /^x?t\/.*\.t$/ and (-e '.git' or -e '.svn')) } }; if ($extra_tests) { - if (eval { - require indirect; - require multidimensional; - require bareword::filehandles; - 1 - }) { + my @failed; + if (eval { require indirect; 1 }) { indirect->unimport(':fatal'); + } else { + push @failed, 'indirect'; + } + if (eval { require multidimensional; 1 }) { multidimensional->unimport; + } else { + push @failed, 'multidimensional'; + } + if (eval { require bareword::filehandles; 1 }) { bareword::filehandles->unimport; } else { - die "strictures.pm extra testing active but couldn't load modules. + push @failed, 'bareword::filehandles'; + } + if (@failed and not $extras_load_warned++) { + my $failed = join ' ', @failed; + warn < +mst - Matt S. Trout (cpan:MSTROUT) =head1 CONTRIBUTORS