On Wed Jul 26 13:22:31 2017, MSTROUT wrote:
Show quoted text> On Wed Jul 26 04:35:22 2017, PALI wrote:
> > Perl fatal warnings are fundamentally broken and should not be used.
>
> They *can* be used fine,
Nope, they cannot. Even warnings documentation by perl5 porters does not recommend to enable fatal warnings. Also there is note "ENTIRELY AT THE USER'S RISK." specially when using XS modules which issue categorized warnings.
Show quoted text> the rant you linked to on p5p is only one
> side of the equation.
>
> Note that strictures v2+ is very careful about which warnings it
> fatalizes - we defatalize 'exec' specifically to avoid the fork/exec
> issues, for example.
So take random one mentioned problem:
$ touch /tmp/test
$ perl5.10.1 -MData::Dumper -e 'stat "/tmp/test"; eval { -l TEST; 1 }; print Dumper([stat _])' 2>/dev/null
$VAR1 = [];
Then verify with non-fatal warnings:
$ perl5.10.1 -MData::Dumper -e 'use warnings; stat "/tmp/test"; eval { -l TEST; 1 }; print Dumper([stat _])' 2>/dev/null
$VAR1 = [];
Output is same, great.
And now with common::sense:
$ touch /tmp/test
$ perl5.10.1 -MData::Dumper -e 'use common::sense; stat "/tmp/test"; eval { -l TEST; 1 }; print Dumper([stat _])' 2>/dev/null
$VAR1 = [
25,
2977687,
33188,
1,
1000,
1000,
0,
0,
1501673359,
1501673359,
1501673359,
4096,
0
];
And result is completely different, just because of fatal warnings. Nasty, common::sense is really great for heisenbugs and for debugging...
So common::sense here is a problem.
And this is just one example.
Show quoted text> I would encourage common::sense to follow our lead in defanging the
> riskier warnings, and encourage all common::sense users to switch to
> strictures unless/until it's fixed.
So please make warnings non-fatal by default and people who understand risk could optionally enable fatalization.
Because now it is needed to call use warnings NONFATAL => "all"; after each usage of common::sense.