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