From: Karen Etheridge Date: Sat, 6 Jul 2019 18:15:35 +0000 (-0700) Subject: use more efficient expr form of map, grep when possible X-Git-Tag: v0.31~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e32cfa2b055050638f172b47ccad9211d8e0de45;p=p5sagit%2FTry-Tiny.git use more efficient expr form of map, grep when possible --- diff --git a/lib/Try/Tiny.pm b/lib/Try/Tiny.pm index af1c463..28ef9a7 100644 --- a/lib/Try/Tiny.pm +++ b/lib/Try/Tiny.pm @@ -78,7 +78,7 @@ sub try (&;@) { # file scope + local but that causes issues with perls < 5.20 due to # perl rt#119311 local $_finally_guards{guards} = [ - map { Try::Tiny::ScopeGuard->_new($_) } + map Try::Tiny::ScopeGuard->_new($_), @finally ]; diff --git a/t/finally.t b/t/finally.t index 76adf4d..00339bc 100644 --- a/t/finally.t +++ b/t/finally.t @@ -119,7 +119,7 @@ is($_, "foo", "same afterwards"); is( scalar @warnings, 2, 'warnings from both fatal finally blocks' ); - my @originals = sort map { $_ =~ /Original exception text follows:\n\n(.+)/s } @warnings; + my @originals = sort map /Original exception text follows:\n\n(.+)/s, @warnings; like $originals[0], qr/fin 1 at/, 'First warning contains original exception'; like $originals[1], qr/fin 3 at/, 'Second warning contains original exception';