X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fstrictures.pm;h=e7882d65d64533ce01a4b7465eb6b39eee2fd981;hb=ffedb166dfd9760a9120a2b28c646300b4491bfa;hp=06301c003a4a7f6a3256048db53fab65df10ae52;hpb=23d8c3be939c8fb02a7ff52851cf211d10b00db5;p=p5sagit%2Fstrictures.git diff --git a/lib/strictures.pm b/lib/strictures.pm index 06301c0..e7882d6 100644 --- a/lib/strictures.pm +++ b/lib/strictures.pm @@ -3,6 +3,8 @@ package strictures; use strict; use warnings FATAL => 'all'; +use constant _PERL_LT_5_8_4 => ($] < 5.008004) ? 1 : 0; + our $VERSION = '1.002002'; # 1.2.2 sub VERSION { @@ -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 { + 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\/.*(?:load|compile|coverage|use_ok).*\.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 <