From: Mark Fowler Date: Wed, 25 Jul 2012 15:13:56 +0000 (-0400) Subject: Change caller to show blocks belonging to our caller X-Git-Tag: Try-Tiny-0.15~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1131a831dede7eb5bfd64eda28dbc554f7287777;p=p5sagit%2FTry-Tiny.git Change caller to show blocks belonging to our caller --- diff --git a/lib/Try/Tiny.pm b/lib/Try/Tiny.pm index 7e0ee47..bf2a91e 100644 --- a/lib/Try/Tiny.pm +++ b/lib/Try/Tiny.pm @@ -50,9 +50,10 @@ sub try (&;@) { # $catch->(); # name the blocks if we have Sub::Name installed - subname("try {...}" => $try); - subname("catch {...} " => $catch) if $catch; - subname("finally {...} " => $_) foreach @finally; + my $caller = caller; + subname("${caller}::try {...}" => $try); + subname("${caller}::catch {...} " => $catch) if $catch; + subname("${caller}::finally {...} " => $_) foreach @finally; # save the value of $@ so we can set $@ back to it in the beginning of the eval # and restore $@ after the eval finishes