in reply to Catching a 'division by zero' error with Exception::Class
Before going into Exception classes, you might want to play with eval without the Exception classes. Get familliar with how perl handles exceptions before doing anything else.
EG
eval { die "woot!\n" }; if ( $@ =~ /woot/ ) { die "This is a 'woot' error!\n" } else { die $@; }
If you're not familiar, eval {} and eval "" are totally different animals, so watch out for that confusion. eval {} is really like a try block in most other languages. eval "" is like eval in other languages.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Catching a 'division by zero' error with Exception::Class
by ggvaidya (Pilgrim) on Sep 16, 2008 at 04:47 UTC | |
by mr_mischief (Monsignor) on Sep 19, 2008 at 23:26 UTC | |
by ggvaidya (Pilgrim) on Sep 20, 2008 at 09:17 UTC | |
by mr_mischief (Monsignor) on Sep 22, 2008 at 14:23 UTC |