From: Graham Knop Date: Mon, 26 Jan 2015 23:06:11 +0000 (-0500) Subject: delay checking for vcs dirs until we are in an appropriate file X-Git-Tag: v1.005006~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2da53f4a5ec76c723b169e72c34eb178999519a6;p=p5sagit%2Fstrictures.git delay checking for vcs dirs until we are in an appropriate file --- diff --git a/lib/strictures.pm b/lib/strictures.pm index 05d7d9f..b7e96e1 100644 --- a/lib/strictures.pm +++ b/lib/strictures.pm @@ -24,9 +24,7 @@ sub VERSION { our $extra_load_states; -our $Smells_Like_VCS = (-e '.git' || -e '.svn' || -e '.hg' - || (-e '../../dist.ini' - && (-e '../../.git' || -e '../../.svn' || -e '../../.hg' ))); +our $Smells_Like_VCS; sub import { strict->import; @@ -39,9 +37,14 @@ sub import { . "please unset \$ENV{PERL_STRICTURES_EXTRA}\n"; } $ENV{PERL_STRICTURES_EXTRA}; - } elsif (! _PERL_LT_5_8_4) { - !!((caller)[1] =~ /^(?:t|xt|lib|blib)[\\\/]/ - and $Smells_Like_VCS) + } elsif (_PERL_LT_5_8_4) { + (caller)[1] =~ /^(?:t|xt|lib|blib)[\\\/]/ + and defined $Smells_Like_VCS ? $Smells_Like_VCS + : ( $Smells_Like_VCS = ( + -e '.git' || -e '.svn' || -e '.hg' + || (-e '../../dist.ini' + && (-e '../../.git' || -e '../../.svn' || -e '../../.hg' )) + )) } }; if ($extra_tests) {