X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2F_Util.pm;h=58e9e6acbc7af9c62565aaaacbd5b2fe9049c2d4;hb=750a4ad26c8fbe0f513a3abd4a9cb79ef8f40884;hp=8d25ec002fd7494dc778e9b530bc535726ee51ed;hpb=e1d9e578b84f642cb24181d0403b15ab78a9fda7;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 8d25ec0..58e9e6a 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -4,7 +4,7 @@ package # hide from PAUSE use warnings; use strict; -use constant SPURIOUS_VERSION_CHECK_WARNINGS => ($] < 5.010 ? 1 : 0); +use constant SPURIOUS_VERSION_CHECK_WARNINGS => ( "$]" < 5.010 ? 1 : 0); BEGIN { package # hide from pause @@ -17,16 +17,15 @@ BEGIN { # but of course BROKEN_FORK => ($^O eq 'MSWin32') ? 1 : 0, - BROKEN_GOTO => ($] < '5.008003') ? 1 : 0, + BROKEN_GOTO => ( "$]" < 5.008003 ) ? 1 : 0, HAS_ITHREADS => $Config{useithreads} ? 1 : 0, - # ::Runmode would only be loaded by DBICTest, which in turn implies t/ - DBICTEST => eval { DBICTest::RunMode->is_author } ? 1 : 0, + DBICTEST => $INC{"DBICTest/Util.pm"} ? 1 : 0, # During 5.13 dev cycle HELEMs started to leak on copy # add an escape for these perls ON SMOKERS - a user will still get death - PEEPEENESS => ( eval { DBICTest::RunMode->is_smoker } && ($] >= 5.013005 and $] <= 5.013006) ), + PEEPEENESS => ( eval { DBICTest::RunMode->is_smoker } && ( "$]" >= 5.013005 and "$]" <= 5.013006) ), SHUFFLE_UNORDERED_RESULTSETS => $ENV{DBIC_SHUFFLE_UNORDERED_RESULTSETS} ? 1 : 0, @@ -43,7 +42,7 @@ BEGIN { OS_NAME => $^O, }; - if ($] < 5.009_005) { + if ( "$]" < 5.009_005) { require MRO::Compat; constant->import( OLD_MRO => 1 ); } @@ -165,6 +164,27 @@ sub is_exception ($) { die $suberror } } + elsif ( + # a ref evaluating to '' is definitively a "null object" + ( not $not_blank ) + and + length( my $class = ref $e ) + ) { + carp_unique( sprintf( + "Objects of external exception class '%s' stringify to '' (the " + . 'empty string), implementing the so called null-object-pattern. ' + . 'Given Perl\'s "globally cooperative" exception handling using this ' + . 'class of exceptions is extremely dangerous, as it may (and often ' + . 'does) result in silent discarding of errors. DBIx::Class tries to ' + . 'work around this as much as possible, but other parts of your ' + . 'software stack may not be even aware of the problem. Please submit ' + . 'a bugreport against the distribution containing %s.', + + ($class) x 2, + )); + + $not_blank = 1; + } return $not_blank; } @@ -260,7 +280,7 @@ sub modver_gt_or_eq_and_lt ($$$) { } my $cf = 1; - while ( ( (caller($cf+1))[3] || '' ) =~ / :: (?: + while ( ( (CORE::caller($cf+1))[3] || '' ) =~ / :: (?: # these are public API parts that alter behavior on wantarray search | search_related | slice | search_literal @@ -278,8 +298,8 @@ sub modver_gt_or_eq_and_lt ($$$) { my ($fr, $want, $argdesc); { package DB; - $fr = [ caller($cf) ]; - $want = ( caller($cf-1) )[5]; + $fr = [ CORE::caller($cf) ]; + $want = ( CORE::caller($cf-1) )[5]; $argdesc = ref $DB::args[0] ? DBIx::Class::_Util::refdesc($DB::args[0]) : 'non ' @@ -305,7 +325,7 @@ sub fail_on_internal_call { my ($fr, $argdesc); { package DB; - $fr = [ caller(1) ]; + $fr = [ CORE::caller(1) ]; $argdesc = ref $DB::args[0] ? DBIx::Class::_Util::refdesc($DB::args[0]) : undef