Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

PERL5OPT and -M

by perl5ever (Pilgrim)
on Mar 10, 2009 at 21:08 UTC ( [id://749729]=perlquestion: print w/replies, xml ) Need Help??

perl5ever has asked for the wisdom of the Perl Monks concerning the following question:

I have PERL5OPT set to -Mlib=/my/personal/lib, and I am encountering this strange behavior. The module Devel::LeakTrace::Fast is located under /my/personal/lib.
$ perl -e 'print join("\n", @INC)' ... lists /my/personal/lib among others $ perl -MDevel::LeakTrace::Fast -e 1 Can't locate Devel/LeakTrace/Fast.pm in @INC (@INC contains: ... ) NOTE: /my/personal/lib NOT listed here $ perl $PERL5OPT -MDevel::LeakTrace::Fast -e 1 (works no problems)
The documentation says that PERL5OPT options are taken as if they appear on every perl command line. However, it looks as if those options are appended to the end of the command line. Is that what's going on?

Is there a way to get PERL5OPT options to appear in front of the supplied command line options?

Replies are listed 'Best First'.
Re: PERL5OPT and -M
by moritz (Cardinal) on Mar 10, 2009 at 21:15 UTC
    Just use PERL5LIB=/my/personal/lib instead, it's exactly made for the situation at hand, and a bit cleaner at that.

    Update: see perlrun for details.

      Yes, PERL5LIB is what I want - thanks!
Re: PERL5OPT and -M
by xdg (Monsignor) on Mar 11, 2009 at 01:44 UTC

    If you set PERL5OPT to -I/my/personal/lib that should take effect before any "-M" options are processed. Or use PERL5LIB (unless you need to run code in taint mode).

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://749729]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found