"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Sometimes, one of my comparison subroutines causes a run-time warning. Perl has an amazing ability to do "something reasonable" in a situation like this and I am happy with what Perl does.
But the warning message doesn't tell me enough to go quickly to the input record that caused the problem. This is demonstrated below. What I would like to do is: if a warning happens within compareLT105(), is to print something specific to this particular subroutine call, like: $arrayRef->[0] in addition to the Perl generated warning. That would narrow the field from ~1 million records to one record. I don't want to "die", I just want to add something to the warning message. I read about installing a __WARN__ signal handler, but that appears to require exposing $arrayRef to a wider scope. Block eval{} works with "die". This is of course a very simplistic version of the "real thing", but I hope provides enough info to get me on the right track. I hope the solution is so easy that it is a "Duh!".
In reply to How to modify a warning message within a sub? by Marshall
|
|