[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
PERL5OPT -M processed after command line -M?
I was a little surprised to find that -M switches in PERL5OPT get
processed after any -M options on the command line. (Whereas -I
options in PERL5OPT are processed earlier as expected.)
E.g., assuming foo.pm in lib/
# works
$ perl -Ilib -Mfoo -e 1
$ perl -Mlib=lib -Mfoo -e 1
$ PERL5OPT=-Ilib perl -Mfoo -e 1
# doesn't work
$ PERL5OPT=-Mlib=lib perl -Mfoo -e 1
The implication is that one can't (shouldn't) use modules in PERL5OPT
to manipulate @INC or override how modules are loaded. Among
practical applications, that would seem to rule out the CPAN::PERL5INC
trick to replace $ENV{PERL5LIB} munging with a module loaded from
PERL5OPT. (Which was intended to avoid having PERL5LIB clipped by OS
limitations.)
If this is intentional behavior, then it would be good to document it
in perlrun. If it's not intentional, should it be fixed? Or is
fixing it likely to break other things?
-- David
- Follow-Ups from:
-
"Rafael Garcia-Suarez" <rgarciasuarez@gmail.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]