X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstrictures.pm;h=f1f39b2ec063f3959a3c3b05c8e1f43bcc581422;hb=0e8766d0eee04c3b17318d64ee7c9fd1f026795b;hp=3c3c0051861b71d17c68457db7b19636cf705904;hpb=d81f898dc9b139b6af40e2b2edd1708e03ff6ad6;p=p5sagit%2Fstrictures.git diff --git a/lib/strictures.pm b/lib/strictures.pm index 3c3c005..f1f39b2 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.002002'; # 1.2.2 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 <