![]() |
|
Just another Perl shrine | |
PerlMonks |
Best way to replace 'die' with 'warn'by puterboy (Scribe) |
on Dec 06, 2009 at 01:21 UTC ( #811295=perlquestion: print w/replies, xml ) | Need Help?? |
puterboy has asked for the wisdom of the Perl Monks concerning the following question:
Unfortunately, one of the modules I am using (Weather::Com), liberally uses 'die' subroutines for non-fatal errors such as not being able to reach the weather.com server. This causes my whole Perl script to die, when at most I might want to warn and either ignore or try again. So, without modifying the module itself, I would like to change the actions of all embedded 'die' commands to 'warn'. The only way I can see to do that is to wrap each call to such a subroutine in Weather::Com as follows: My questions are: 1. Is this the best/simplest way to do what I want? 2. Does wrapping in 'eval' (and changing $SIG{__DIE__} locally) have the potential to cause any additional and potentially undesirable side effects?
Back to
Seekers of Perl Wisdom
|
|