On Thu, Aug 10, 2000 at 02:56:59AM -0500, Jonathan Scott Duff wrote:
> Peter Scott writes:
> > try {
> > # fragile code
> > } catch Exception::IO with {
> > # handle IO exceptions
> > } catch Exception::Socket with {
> > # handle network exceptions
> > } otherwise {
> > # handle other exceptions
> > };
>
> What would the difference between that and this be?
>
> try {
> # fragile code
> } catch { # catch ALL exceptions
> switch ($EXCEPTION->name) {
> case IO { ... }
> case Socket { ... }
> }
> }
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.
Graham.