Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Module wants to die! How do I handle this?

by JediWizard (Deacon)
on Jul 11, 2005 at 18:45 UTC ( [id://474052]=note: print w/replies, xml ) Need Help??


in reply to Module wants to die! How do I handle this?

I would wrap the offending calls in an eval, and then check the value of $@ after to look for errors. See (brief) example below:

eval{&i_will_die}; if(defined($@)){ # handle the error } sub i_will_die { die "Life stinks, I give up\n"; }

They say that time changes things, but you actually have to change them yourself.

—Andy Warhol

Replies are listed 'Best First'.
Re^2: Module wants to die! How do I handle this?
by haoess (Curate) on Jul 11, 2005 at 19:38 UTC

    $@ seems always to be defined:

    $ perl -Mstrict -wle 'print defined $@'
    1
    

    Therefore you better check for a true value in $@:

    if ($@) { ... }
    

    --Frank

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://474052]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-16 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found