On 2/5/25 16:18, Karl Berry wrote:
Hi Jacob,

     If a plain "use warnings;" in a script overrides setting
     PERL5OPT=-Mwarnings=FATAL,all in the environment,

Fortunately, it was my mistake. I got confused in the testing I was
doing.  use warnings; in a script does not override that PERL5OPT
setting.  I'll fix the intentional warning in
parallel-tests-log-compiler-example in another way. By unsetting
PERL5OPT in the test script seems simplest, I guess, unless you can
think of a better way. --thanks, karl.

Unsetting it in the Perl script should be too late---PERL5OPT is applied before any code is even compiled if I understand correctly.

Unsetting it in the shell test driver could work, as could simply prepending "PERL5OPT= " or "PERL5OPT='' " to the line that actually executes the Perl script (to cause the shell to set PERL5OPT to an empty string for that command only).  If you do this, make sure to add a comment explaining why that setting is there and why it is important.

I am uncertain when NONFATAL was introduced; FATAL warnings existed all the way back in perl 5.6.0.  (The historical Perl documentation all the way back to Perl 5.005 is kept online at <URL:https://perldoc.perl.org> for easy reference.)

Does the test rely on perl emitting a warning?  If not, you could simply add "no warnings;" to the test script (along with a comment explaining why this script---and only this script---needs that). Turning warnings off entirely has always overridden fatal warnings as far as I can tell.


-- Jacob



Reply via email to