($ENV{TRAVIS_REPO_SLUG}||'') =~ m|\w+/dbix-class$|
)
) {
- require Try::Tiny;
- my $orig = \&Try::Tiny::try;
-
- # 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;
- while( $first_pkg = caller($fr++) ) {
- last if $first_pkg !~ /^
- __ANON__
- |
- \Q(eval)\E
- $/x;
- }
-
- if ($first_pkg =~ /DBIx::Class/) {
- require Test::Builder;
- Test::Builder->new->ok(0,
- 'Using try{} within DBIC internals is a mistake - use dbic_internal_try{} instead'
- );
- }
-
- goto $orig;
- };
+ # two levels of if() because of taint mode tangling the %ENV-checks
+ # with the require() call, sigh...
+
+ if ( eval { require Try::Tiny } ) {
+ my $orig = \&Try::Tiny::try;
+
+ # 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;
+ while( $first_pkg = caller($fr++) ) {
+ last if $first_pkg !~ /^
+ __ANON__
+ |
+ \Q(eval)\E
+ $/x;
+ }
+
+ if ($first_pkg =~ /DBIx::Class/) {
+ require Test::Builder;
+ Test::Builder->new->ok(0,
+ 'Using try{} within DBIC internals is a mistake - use dbic_internal_try{} instead'
+ );
+ }
+
+ goto $orig;
+ };
+ }
}
}