in reply to Error module
## lowercase Use, and 'qw' not 'qe' use Error qw(:try); try { &func1(); print "still in try block\n"; } catch Error::Simple with { my $err = shift; print "Error: ", $err->{'-text'}, "\n"; print "had some problem\n"; } otherwise { print "in otherwise block\n"; }; #^ you *must* have a semi-colon as try/catch/etc # are user-defined subroutines. the docs mention this # in the SYNOPSIS sub func1 { print "in func1\n"; throw Error::Simple('throwing simple error'); } __output__ in func1 Error: throwing simple error had some problem
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Error module
by hotshot (Prior) on Aug 18, 2003 at 11:15 UTC | |
by broquaint (Abbot) on Aug 18, 2003 at 11:45 UTC | |
by hotshot (Prior) on Aug 18, 2003 at 16:22 UTC | |
by dragonchild (Archbishop) on Aug 18, 2003 at 17:07 UTC | |
by hotshot (Prior) on Aug 19, 2003 at 05:40 UTC | |
|