From: Aristotle Pagaltzis Date: Thu, 13 Apr 2017 15:56:49 +0000 (+0200) Subject: only invoke caller() when _HAS_SUBNAME X-Git-Tag: v0.29~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=339b2ba3b058f5d9686f5254464acbdfac2c8398;p=p5sagit%2FTry-Tiny.git only invoke caller() when _HAS_SUBNAME --- diff --git a/lib/Try/Tiny.pm b/lib/Try/Tiny.pm index 6592632..9a40de9 100644 --- a/lib/Try/Tiny.pm +++ b/lib/Try/Tiny.pm @@ -70,8 +70,7 @@ sub try (&;@) { # $catch->(); # name the blocks if we have Sub::Name installed - my $caller = caller; - _subname("${caller}::try {...} " => $try) + _subname(caller.'::try {...} ' => $try) if _HAS_SUBNAME; # set up scope guards to invoke the finally blocks at the end. @@ -140,8 +139,7 @@ sub catch (&;@) { croak 'Useless bare catch()' unless wantarray; - my $caller = caller; - _subname("${caller}::catch {...} " => $block) + _subname(caller.'::catch {...} ' => $block) if _HAS_SUBNAME; return ( bless(\$block, 'Try::Tiny::Catch'), @@ -154,8 +152,7 @@ sub finally (&;@) { croak 'Useless bare finally()' unless wantarray; - my $caller = caller; - _subname("${caller}::finally {...} " => $block) + _subname(caller.'::finally {...} ' => $block) if _HAS_SUBNAME; return ( bless(\$block, 'Try::Tiny::Finally'),