in reply to log::log4perl capture warnings
As you can see, the final statement is not executed, we don't even "get there".$ perl -e 'use strict; use warnings; my $c = 1/0; print "we get there\ +n";' Illegal division by zero at -e line 1. $
Compare to this, where the error is trapped within an eval block:
Here, the program does not die, but checking the value of the $@ makes it possible for the developer to possibly take other actions than just dying (for example if something can be recovered, so that the error should not be fatal).$ perl -e 'use strict; use warnings; eval {my $c = 1/0;}; print "we +get there but got the following problem:\n $@ \n";' we get there but got the following problem: Illegal division by zero at -e line 1. $
|
|---|