On Tue, May 27, 2003 at 02:27:29PM -0400 Moshe wrote:

> How do I catch/handle runtime errors in Perl?
> 
> Something like:
> 
> try {
> 
> } catch (e) {}
> 
> or

Use a block eval:

    eval {
        # potentially failing code
    };
    if ($@) {
        print "An error occured: $@";
    }

$@ is special in that it could also be an object. That depends on the
code that throws this error. If it does a

    die $object;

$object is eventually to be found in [EMAIL PROTECTED] But I don't know of any module
that would make use of this feature.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to