From: Peter Rabbitson Date: Sat, 10 Nov 2012 14:59:51 +0000 (+0100) Subject: Attempt to load extra testing modules only once X-Git-Tag: v1.004003~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f2198852d1b54f148ff16840602f4017a14e2ad;p=p5sagit%2Fstrictures.git Attempt to load extra testing modules only once --- diff --git a/Changes b/Changes index c171e47..b6c3d27 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ + - check only once for presence of extra testing prereqs 1.004002 - 2012-09-08 - add better rationale for the extra testing heuristic 1.004001 - 2012-07-12 diff --git a/lib/strictures.pm b/lib/strictures.pm index f890487..2ef91fe 100644 --- a/lib/strictures.pm +++ b/lib/strictures.pm @@ -21,7 +21,7 @@ sub VERSION { shift->SUPER::VERSION(@_); } -my $extras_load_warned; +my $extra_load_states; our $Smells_Like_VCS = (-e '.git' || -e '.svn' || (-e '../../dist.ini' && (-e '../../.git' || -e '../../.svn'))); @@ -43,25 +43,22 @@ sub import { } }; if ($extra_tests) { - 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 { - push @failed, 'bareword::filehandles'; - } - if (@failed and not $extras_load_warned++) { - my $failed = join ' ', @failed; - warn <unimport(':fatal') if $extra_load_states->{indirect}; + multidimensional->unimport if $extra_load_states->{multidimensional}; + bareword::filehandles->unimport if $extra_load_states->{'bareword::filehandles'}; } }