http://www.perlmonks.org?node_id=811295

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:
{ local $SIG{__DIE__} = sub { warn(@_); }; eval { weather_subroutine(); }; }
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?