[ABE.pm] trapping warnings
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Fri Oct 5 04:26:12 PDT 2007
* "Faber J. Fedor" <faber at linuxnj.com> [2007-10-04T22:37:34]
> On 04/10/07 20:31 -0400, Ricardo SIGNES wrote:
> > * "Faber J. Fedor" <faber at linuxnj.com> [2007-10-04T20:03:56]
> > > How do I trap this and DIE with an error message?
> >
> > Rather than using an actual SIG{__?__} handler, consider catching that
> > problem before it occurs:
>
> I like both ideas. Ted's to catch the error in the first place and
> your's to fix it once it's been caught.
Well, but the code that I provided would never generate a warning... or at
least that was the intent. You probably want a ||0 in there. I would suggest
that in 99.999% of all cases, the correct answer is to avoid the warning, not
to write a sigwarn. In fact, I think the ONLY time I have ever written a
__WARN__ signal handler has been in tests, to ensure that a warning occurs when
I want it.
SIG{__DIE__} is only overkill 97% of the time. Usually the answer is eval.
--
rjbs
More information about the ABE-pm
mailing list