No I meant more plausible.
Perl is so flexible that you can most likely create false positives for every warning.
Doesn't mean they appear frequently enough for not being tolerable or solvable.
Here a similar example where redefine is causing a "false positive"
use strict; use warnings; use feature "say"; #no warnings 'redefine'; sub tst {1} BEGIN { $a = \&tst } sub tst {2} BEGIN { $b = \&tst } say &$a; say &$b;
perl false_postive_redefine.pl Subroutine tst redefined at false_postive_redefine.pl line 7. 1 2
And here a solution to your example.
Just move the use Try::Tiny into the scope where it belongs. This makes the code also far clearer.
use feature "try"; use constant CHECK_HINTHASH => 0; sub check_hinthash {warn "feature_try = ".$^H{feature_try} if CHECK_HI +NTHASH} #... BEGIN { check_hinthash() } # feature enabled { no feature qw( try ); BEGIN { check_hinthash() } # feature disabled use Try::Tiny qw( try catch ); try { ... }; } BEGIN { check_hinthash() } # feature enabled # try { ... }; <-- would fail
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
In reply to Re^17: Try::Tiny and -E (False Positive)
by LanX
in thread Try::Tiny and -E
by 1nickt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |