Don't ask to ask, just ask | |
PerlMonks |
Re^5: Catching a 'division by zero' error with Exception::Classby dreadpiratepeter (Priest) |
on Sep 15, 2008 at 16:56 UTC ( [id://711501]=note: print w/replies, xml ) | Need Help?? |
First of all, the file open does not need to go into an eval. Secondly, as far as I can see the else will trigger on a successful run (ie no error) Are you sure the uunwritable file is really unwritable? and that you arent just successfully opening the file? UPDATE: Looking at the examples in the docs for Exception::Class they seem to make the assumption that your eval always throws an exception. Try changing to It says that caught without args simply returns $@ (which if successful will be undef), so that will keep it from throwing the empty die you are seeing -pete "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
In Section
Seekers of Perl Wisdom
|
|