X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCarp.pm;h=e1c83a0caf39a92b01e6d439bcb08b42fd0370b8;hp=9474dc1c353e70570692090f9589c0069625e7f6;hb=73f54e275e7dc98b4a082475ff252afdbeca182f;hpb=e570488ade8f327f47dd3318db3443a348d561d6 diff --git a/lib/DBIx/Class/Carp.pm b/lib/DBIx/Class/Carp.pm index 9474dc1..e1c83a0 100644 --- a/lib/DBIx/Class/Carp.pm +++ b/lib/DBIx/Class/Carp.pm @@ -53,11 +53,23 @@ sub __find_caller { my $fr_num = 1; # skip us and the calling carp* - my (@f, $origin); + my (@f, $origin, $eval_src); while (@f = CORE::caller($fr_num++)) { - next if - ( $f[3] eq '(eval)' or $f[3] =~ /::__ANON__$/ ); + undef $eval_src; + + next if ( + $f[2] == 0 + or + # there is no value reporting a sourceless eval frame + ( + ( $f[3] eq '(eval)' or $f[1] =~ /^\(eval \d+\)$/ ) + and + not defined ( $eval_src = (CORE::caller($fr_num))[6] ) + ) + or + $f[3] =~ /::__ANON__$/ + ); $origin ||= ( $f[3] =~ /^ (.+) :: ([^\:]+) $/x @@ -84,7 +96,7 @@ sub __find_caller { } my $site = @f # if empty - nothing matched - full stack - ? "at $f[1] line $f[2]" + ? ( "at $f[1] line $f[2]" . ( $eval_src ? "\n === BEGIN $f[1]\n$eval_src\n === END $f[1]" : '' ) ) : Carp::longmess() ;