detect when running tests via dzil
[p5sagit/strictures.git] / lib / strictures.pm
index 3d2e24d..1202799 100644 (file)
@@ -23,6 +23,9 @@ sub VERSION {
 
 my $extras_load_warned;
 
+our $Smells_Like_VCS = (-e '.git' || -e '.svn'
+  || (-e '../../dist.ini' && (-e '../../.git' || -e '../../.svn')));
+
 sub import {
   strict->import;
   warnings->import(FATAL => 'all');
@@ -30,13 +33,13 @@ sub import {
   my $extra_tests = do {
     if (exists $ENV{PERL_STRICTURES_EXTRA}) {
       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, '
+        die 'PERL_STRICTURES_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) {
       !!((caller)[1] =~ /^(?:t|xt|lib|blib)/
-         and (-e '.git' or -e '.svn'))
+         and $Smells_Like_VCS)
     }
   };
   if ($extra_tests) {