From: Graham Knop Date: Sat, 31 May 2014 21:18:50 +0000 (-0400) Subject: factor out env check from file check X-Git-Tag: v1.999_001~1^2~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d763997aceafbe007f36a847780a2d0293f3468;p=p5sagit%2Fstrictures.git factor out env check from file check --- diff --git a/lib/strictures.pm b/lib/strictures.pm index e1fe753..f14f7e9 100644 --- a/lib/strictures.pm +++ b/lib/strictures.pm @@ -65,15 +65,22 @@ sub _enable_1 { } } -sub _want_extra { - my $file = shift; +sub _want_extra_env { if (exists $ENV{PERL_STRICTURES_EXTRA}) { if (_PERL_LT_5_8_4 and $ENV{PERL_STRICTURES_EXTRA}) { die 'PERL_STRICTURES_EXTRA checks are not available on perls older' . "than 5.8.4: please unset \$ENV{PERL_STRICTURES_EXTRA}\n"; } - return $ENV{PERL_STRICTURES_EXTRA}; + return $ENV{PERL_STRICTURES_EXTRA} ? 1 : 0; } + return undef; +} + +sub _want_extra { + my $file = shift; + my $want_env = _want_extra_env(); + return $want_env + if defined $want_env; return ( !_PERL_LT_5_8_4 and $file =~ /^(?:t|xt|lib|blib)[\\\/]/