in reply to Re: How many different ways can Perl code fail?
in thread How many different ways can Perl code fail?
Check for eval returning undef + $@ != null.
Checking $@ is a bit unreliable. Better:
if (!eval { ...; 1 }) { ...error handler... }
Or if you need the return value:
my $rv; if (!eval { $rv = ...; 1 }) { ...error handler... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How many different ways can Perl code fail?
by diotalevi (Canon) on Jan 14, 2009 at 09:10 UTC | |
by sgt (Deacon) on Jan 14, 2009 at 21:39 UTC | |
|
Re^3: How many different ways can Perl code fail?
by wol (Hermit) on Jan 14, 2009 at 17:45 UTC | |
by ikegami (Patriarch) on Jan 14, 2009 at 18:00 UTC |