|Welcome to the Monastery|
is there a way to avoid dieing ?by palkia (Monk)
|on Apr 27, 2011 at 02:24 UTC||Need Help??|
palkia has asked for the
wisdom of the Perl Monks concerning the following question:
In case you've wondered, I'm not asking about biological immortality (although I wouldn't object to an answers for that too).
I'm using a module that sometimes uses the die function and shutting down my program all together.
My question is: Is there a way for me to call a function from that module (without changing it of course), and instead of dieing, having the string printed by that preformed die function, returned instead ?
I guess I want something like this:
my $die_Message = immortal( some_module_function( $param1 , $param2 , .. ) );
so if some_module_function died, the program wouldn't and instead store the die message in $die_Message,
and if it didn't die, it would simply preform the module's function exactly like it would if "immortal" wasn't there (don't care much about the return in this scenario).