At 05:11 PM 8/10/00 +0100, Graham Barr wrote:
>I was more thinking of
>
> eval {
> # fragile code
> }
> else { # catch ALL exceptions
> switch ($@) {
> case __->isa('IO') { ... }
> case __->isa('Socket') { ... }
> else { ... }
> }
> }
> continue {
> # code always executed (ie finally)
> }
>
>And the only new keywords are for the switch statement.
Do you propose this solely to conserve keywords, or is there another
advantage? I find
try {
#
} catch Exception::Thingy with {
#
} catch Exception::Whatsit with {
#
} otherwise {
#
};
considerably more appealing, especially since catch blocks can contain tens
of statements. It's easier to see the exception class (not tucked inside a
method call), and there aren't additional block levels.
BTW, the methods in Error.pm I don't use are except() and record().
--
Peter Scott
Pacific Systems Design Technologies