doy / try-tiny

minimal try/catch with proper preservation of $@
http://metacpan.org/release/Try-Tiny
10 stars 15 forks source link

(Perl update?) Can't call method catch on undefined value #23

Closed utrack closed 9 years ago

utrack commented 9 years ago

Hey, I'm using Perl v 5.20.1 (It was updated recently) and I started to receive an odd bug:

Code (simplified):

try { someprocedure(); # does not throw anything, if error then everything is okay } catch { print "Error: $_"; };

If anything is thrown then it works and outputs an error, but when nothing is thrown it complains about (1) undefined $ when concatenating string for print (2) if I'm adding check like if ($) it throws "Can't call method "catch" on an undefined value".

doy commented 9 years ago

This sounds like you're missing a use Try::Tiny somewhere. Can you give me a sample script that demonstrates this error?

utrack commented 9 years ago

Yeah, sorry! Found out someone else was moving code in the same time. Guess that one can be closed :)