Syntactic Confectionery Delight | |
PerlMonks |
Re: Can I catch exceptionsby iakobski (Pilgrim) |
on Jun 26, 2001 at 15:30 UTC ( [id://91558]=note: print w/replies, xml ) | Need Help?? |
The first two answers are correct answers to your question, however they will not solve your problem.
What you are seeing is not an exception or an error, it is a warning. A subtle difference perhaps, but the eval and die technique will not trap warnings. What you need to do is to temporarily modify __WARN__ so that instead of the default, which is to print out the warning, it does what you want. You say that you want to catch the "error" and generate your own message. You could do something like this: Note that you MUST enclose this in a block (such as putting it in it's own sub like this) otherwise you will be confused by any other warnings later printing your own message. -- iakobski
In Section
Seekers of Perl Wisdom
|
|