develooper Front page | perl.perl5.porters | Postings from November 2017

$EXPORT_ALL now warns

Thread Next
Father Chrysostomos
November 17, 2017 04:10
$EXPORT_ALL now warns
Message ID:
$EXPORT_ALL now warns

Yves Orton made this commit about a year ago:
> commit eafd371ce091bf61fe1673448eee5e53c4b0ef32
> Author: Yves Orton <>
> Date:   Wed Oct 19 11:09:00 2016 +0200
>     gv.c: rework special var matching logic to be simpler
>     The old code used a bunch of tricks that IMO are unlikely
>     to actually make any performance difference, and make
>     the code harder to read, search, and understand, and less
>     amenable to using string constant friendly macros.
>     So for instance instead of switching on the first char
>     and then comparing the second on for an exact match
>     instead just compare the full string. The extra char
>     is unlikely to make a difference to the underlying code
>     that gets called, and the end result is easier searching.
>     Another issue is that some of the code was inadverdantly
>     doing prefix matches, and not exact matchs for certain
>     magic var names. This is fixed as part of these changes.

I would argu that the EXPORT check was not inadvertently a prefix
check.  And when somebody proposed changing it in another thread a
few years back, I cited various CPAN modules that showed that people
were relying on it.

This commit changed the behaviour, such that @EXPORT does not warn,
but EXPORT_ANY (used on CPAN) does warn.  (See #123633.)
If I had known about this change in behaviour at the time, I would
have spoken up.

In any case, I recommend we revert to the previous behaviour of
exempting anything beginning with EXPORT from 'used once' warn-
ings.  And the change should be backported to 5.26.x, since it is a

Also, if someone is committing a change that changes observable behav-
iour, please make the first line of the commit message say so.  This:

>     gv.c: rework special var matching logic to be simpler

does not sound like a commit worth looking at.  It sounds like a pure
refactoring.  This:

>     gv.c: Stop doing prefix matching on special vars

would at least have prompted me to take a closer look.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About