in reply to Re: Eliminating "used only once" warnings from List::Util::reduce
in thread Eliminating "used only once" warnings from List::Util::reduce
That's a good guess. If you place a "warn" inside of BEGIN, UNITCHECK, CHECK, INIT, and END blocks, you'll see that the "only once" warning comes immediately after the BEGIN, but before UNITCHECK. It's being generated before runtime, so by the time the subroutine is actually called, it's too late.
Those solutions that deal with import are probably the best answer, though it wouldn't fix fully-qualified usages of reduce (where there is no import call).
I think a better solution would simply be for Perl to completely ignore $a and $b with respect to "used only once" warnings. Those should be additionally special-cased. Now to code-dive again and find where that could be implemented.
Dave
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Eliminating "used only once" warnings from List::Util::reduce
by BrowserUk (Patriarch) on Jul 30, 2013 at 19:12 UTC | |
by davido (Cardinal) on Jul 30, 2013 at 19:28 UTC | |
by BrowserUk (Patriarch) on Jul 30, 2013 at 19:33 UTC | |
Re^3: Eliminating "used only once" warnings from List::Util::reduce
by tobyink (Canon) on Jul 30, 2013 at 20:29 UTC |