While investigating common::sense, I noticed the exhortation to use FATAL warnings. I don't remember seeing this option before, so I thought I'd try it out:
Hmmm. That didn't work so well. Did I do something wrong?$ perl -le 'use warnings qw(FATAL); my $a = "2:" + 3; print $a' 5
Nope, the warning message comes up fine here... well, maybe the "all" is only implied when there actually are no arguments at all.$ perl -le 'use warnings; my $a = "2:" + 3; print $a' Argument "2:" isn't numeric in addition (+) at -e line 1. 5
Aha. There we go. FATAL only works when giving another option. I have to admit, that was unexpected. At the very least, if FATAL with no more arguments doesn't imply "all", I would hope for a warning of some sort. It is the warnings pragma, after all! :-)$ perl -le 'use warnings qw(FATAL all); my $a = "2:" + 3; print $a' Argument "2:" isn't numeric in addition (+) at -e line 1.
(*) I was looking at common::sense as a point of comparison. I'm not in agreement with all of the authors' conclusions, but the concepts are good: automatically engaging strict, warnings, oft-used features, etc., with a single use call rather than mandating a whole bunch of boilerplate. I'd be tempted to use such a module to import a bunch of other stuff, too, but will probably hold off on that as it would start to hide where our logging is coming from (Log::Log4perl) which would serve to confuse rather than simplify.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using FATAL warnings
by ikegami (Patriarch) on Dec 16, 2009 at 18:31 UTC | |
|
Re: using FATAL warnings
by TGI (Parson) on Dec 28, 2009 at 19:31 UTC |