in reply to Error.pm -- Design
I'm not sure what you want. Hopefully, this will help.
Thanks to indirect object syntax,
catch Error::IO ...
is the same as
Error::IO->catch(...)
Thanks to try and with's prototype,
try { ... } catch Error::IO with { ... };
is the same as
try(sub { ... }, Error::IO->catch(with(sub { ... })));
(That's why the trailing ; is necessary.)
In fact, the following would work:
sub stuff { ... } sub err_handler { ... } try \&stuff, catch Error::IO with \&err_handler;
try uses eval BLOCK to catch exceptions (i.e. calls to die). It determines what to do with the caught exception using the object catch returns. throw is a wrapper around die.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error.pm -- Design
by beckmanel (Novice) on Jul 21, 2006 at 20:49 UTC | |
by ikegami (Patriarch) on Jul 21, 2006 at 22:31 UTC | |
by beckmanel (Novice) on Jul 24, 2006 at 13:05 UTC | |
by ikegami (Patriarch) on Jul 24, 2006 at 14:59 UTC | |
|
Re^2: Error.pm -- Design
by beckmanel (Novice) on Jul 24, 2006 at 20:40 UTC | |
by ikegami (Patriarch) on Jul 25, 2006 at 16:54 UTC |