X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FANFANG.pm;h=c60ba9efe7f8fbe8ccc908bdff104105c1d33fb6;hb=50841788d03e2342a00470eb2f458e717922615b;hp=05304bf79594b27c365bba60b5fcad7b770ba30c;hpb=2c4abbea2d69eda73c1b91194eb8b7f52414d522;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/ANFANG.pm b/t/lib/ANFANG.pm index 05304bf..c60ba9e 100644 --- a/t/lib/ANFANG.pm +++ b/t/lib/ANFANG.pm @@ -46,6 +46,13 @@ $INC{$_} ||= __FILE__ for (qw( ANFANG.pm t/lib/ANFANG.pm ./t/lib/ANFANG.pm )); and + # a ghetto way of recognizing cperl without loading Config.pm + # the $] guard is there because touching $^V on pre-5.10 loads + # the entire utf8 stack (wtf!!!) + ( "$]" < 5.010 or $^V !~ /\d+c$/ ) + + and + # just don't check anything under RELEASE_TESTING # a naive approach would be to simply whitelist both # strict and warnings, but pre 5.10 there were even @@ -84,8 +91,9 @@ $INC{$_} ||= __FILE__ for (qw( ANFANG.pm t/lib/ANFANG.pm ./t/lib/ANFANG.pm )); require Carp; - # not loading warnings.pm - local $^W = 0; + # in case we loaded warnings.pm / used -w + # ( do not do `no warnings ...` as it is also a load ) + local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /redefined/ }; *UNIVERSAL::VERSION = sub { Carp::carp( 'Argument "blah bleh bloh" isn\'t numeric in subroutine entry' ); @@ -107,8 +115,9 @@ $INC{$_} ||= __FILE__ for (qw( ANFANG.pm t/lib/ANFANG.pm ./t/lib/ANFANG.pm )); require Try::Tiny; my $orig = \&Try::Tiny::try; - # not loading warnings.pm - local $^W = 0; + # in case we loaded warnings.pm / used -w + # ( do not do `no warnings ...` as it is also a load ) + local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /redefined/ }; *Try::Tiny::try = sub (&;@) { my ($fr, $first_pkg) = 0; @@ -133,15 +142,22 @@ $INC{$_} ||= __FILE__ for (qw( ANFANG.pm t/lib/ANFANG.pm ./t/lib/ANFANG.pm )); } -require lib; -lib->import('t/lib'); +unshift @INC, 't/lib'; # everything expects this to be there -! -d 't/var' and ( +! -d 't/var' + and +( mkdir 't/var' or - die "Unable to create 't/var': $!\n" + # creation is inherently racy + do { + my $err = $!; + require Errno; + die "Unable to create 't/var': $err\n" + unless $err == Errno::EEXIST(); + } );