Another solution is to make warnings fatal (see perllexwarn) and then handle it all with eval. Disadvantage is that it will also catch ordinary errors.
my $success = eval { use warnings FATAL => 'all'; risky_operation(); 1; }; unless ($success) { warn frob_message($!); }
In reply to Re: How to modify a warning message within a sub?
by moritz
in thread How to modify a warning message within a sub?
by Marshall
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |