develooper Front page | perl.perl5.porters | Postings from August 2016

Alternative Fix for base.pm dot-in-INC mechanic.

Thread Next
From:
Kent Fredric
Date:
August 14, 2016 21:34
Subject:
Alternative Fix for base.pm dot-in-INC mechanic.
Message ID:
CAATnKFCTbudNM9S5SifvKacRhVMNjzNhFEf4h5yGmPM1FP42Hg@mail.gmail.com
I'm just relaying the contents of: https://github.com/Perl/perl5/pull/10/files

Because I would be loath if 5.23.3 and 5.24.1 shipped without at least
ensuring this properly considered.

The essential issue is that by localising @INC in base.pm, any changes
made to @INC by the module being loaded are lost.

And so instead of assuming @INC can be simply reverted to its previous
state, it uses a scope guard, and thus tries to effectively localise
*only* the absense of '.' by:

a) only adding cleanup logic if $INC[-1]  is in fact '.'
b) reinserting '.' in the cleanup block on base->import scope exit.

Presently, localising is done regardless of the presence of a ".",
making any @INC modification in base.pm impossible, even if the user
had already removed '.' themselves.

There is other feedback on https://github.com/Perl/perl5/pull/10
potentially worth considering.

Though the contents of the patch are submitted here verbatim as an
attachment for P5P's convenience.

-- 
Kent

KENTNL - https://metacpan.org/author/KENTNL

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About