Institute a central "load this first in testing" package
[dbsrgits/DBIx-Class.git] / xt / extra / internals / namespaces_cleaned.t
index 237a90b..b8b42b7 100644 (file)
@@ -1,5 +1,7 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+
 BEGIN {
-  if ($] < 5.010) {
+  if ( "$]" < 5.010) {
 
     # Pre-5.10 perls pollute %INC on unsuccesfull module
     # require, making it appear as if the module is already
@@ -16,7 +18,7 @@ BEGIN {
     # we want to do this here, in the very beginning, before even
     # warnings/strict are loaded
 
-    unshift @INC, 't/lib';
+
     require DBICTest::Util::OverrideRequire;
 
     DBICTest::Util::OverrideRequire::override_global_require( sub {
@@ -35,8 +37,6 @@ use warnings;
 
 use Test::More;
 
-use lib 't/lib';
-
 use DBICTest;
 use File::Find;
 use File::Spec;
@@ -185,7 +185,7 @@ for my $mod (@modules) {
 sub find_modules {
   my @modules;
 
-  find({
+  find( {
     wanted => sub {
       -f $_ or return;
       s/\.pm$// or return;
@@ -193,7 +193,12 @@ sub find_modules {
       push @modules, join ('::', File::Spec->splitdir($_));
     },
     no_chdir => 1,
-  }, qw( lib blib ) );  # find them in both lib and blib, @INC is preadjusted for us by the harness
+  }, (
+    # find them in both lib and blib, duplicates are fine, since
+    # @INC is preadjusted for us by the harness
+    'lib',
+    ( -e 'blib' ? 'blib' : () ),
+  ));
 
   return sort @modules;
 }