Open hopkinsr opened 3 years ago
I'm not able to reproduce this myself, so we'll have to do a little bit of digging.
First, I'm also not on Windows.
It's also strange that the line 276, the call to List::Util::max()
is getting called because you haven't used --debug
on the command line. Do you have a --debug
in your .ackrc? Do you get the warning if you call ack with --noenv
, which will ignore your .ackrc?
And I don't get the warning when I call echo a | perl ~/bin/ack a --debug
with the debug, either.
One bit of good news, i'm installing a "Hardware VM" (supermini footprint) Win10 unit for Tax purposes, that'll be KVM'd, so I'll be able to test on Win10 for us.
(Note the Future tense, the April 15 deadline shift has made it slightly less pressing ...)
Comments:
This is an excellent bug report.
I'm fascinated that this is somehow an intersection of Debug, Windows (vs *ix), and 5.16 (vs 5.22+). How do those even interact? This will be interesting.
Wouldn't changing from require
to use
inside an if ( $opt_debug )
be an anti-pattern ? use
will be executed as a BEGIN{}
despite the if(){}
wrapper?
For actual conditional import with use semantics requires the if
pragma module thusly -
use if CONDITION, "MODULE", ARGUMENTS;
(Whether that would still fix the observed problem IDK without trying it.)
Yes, I don't want to just switch the require
to use
, but as OP mentioned in his initial email to me, he doesn't really know Perl so I didn't want to get into that.
I'd like to figure out why OP is getting the warning before updating anything.
Thanks for suggesting other things to test.
As it happens I I hadn't got my ackrc setup on Windows at the time, and it happens with or without the file (just colors and --sort-files), and with or without --noenv
on the command line...
echo a | C:\bin\strawberry-perl-5.16.3.1-64bit-portable\perl\bin\perl.exe C:\bin\ack-v3.5.0 --noenv a
List::Util::max() called too early to check prototype at C:\bin\ack-v3.5.0 line 276.
a
I don't know what needs to be changed but I can easily test anything you need.
In fact, I found a simpler case, just run ack --version
...
C:\bin\strawberry-perl-5.16.3.1-64bit-portable\perl\bin\perl.exe C:\bin\ack-v3.5.0 --version --noenv
List::Util::max() called too early to check prototype at C:\bin\ack-v3.5.0 line 276.
ack v3.5.0 (standalone version)
Running under Perl v5.16.3 at C:\bin\strawberry-perl-5.16.3.1-64bit-portable\perl\bin\perl.exe
Copyright 2005-2021 Andy Lester.
This program is free software. You may modify or distribute it
under the terms of the Artistic License v2.0.
I'll look into this on Win10 once i have it set up ... although i should do the tax report that's paying for that system there first !
Bump.
This would be nice to close if it's something I can easily address.
Hmm. I still have a Win10 box available, maybe i can get Strawberry and Ack there to test
Affected versions
Steps to reproduce warning
For example on Windows using Portable edition of Strawberry Perl
then
Steps that work
For example with Perl 5.22
Potential patch to fix warning
Replace
require List::Util;
withuse List::Util;
on line 273.Result of patch
Using the example version of Perl from above with the warning, it's now gone...