Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: changing vaules in perl -V

by syphilis (Chancellor)
on Mar 19, 2013 at 23:22 UTC ( #1024400=note: print w/replies, xml ) Need Help??

in reply to changing vaules in perl -V

Here's a perlish approach as per the way that Mattia Barbon's ExtUtils::FakeConfig achieves the result:
1) Create a that contains:
package Config_m; use warnings; use Config; my $tied = tied %Config; $tied->{installsitebin} = '/usr/bin'; 1;
2) Set the PERL5OPT environment variable to -MConfig_m

With the perl5opt environment variable unset, 'perl -V:installsitebin' (and $Config{installsitebin}) still return their original value.
But, when perl5opt is set correctly, 'perl -V:installsitebin' (and $Config{installsitebin}) will return the new value.

Here's a Windows demo (where PERL5OPT is initially unset):
C:\_32\pscrpt>type package Config_m; use warnings; use Config; my $tied = tied %Config; $tied->{installsitebin} = '/usr/bin'; 1; C:\_32\pscrpt>perl -V:installsitebin installsitebin='c:\MinGW\perl512\bin'; C:\_32\pscrpt>set PERL5OPT=-MConfig_m C:\_32\pscrpt>perl -V:installsitebin installsitebin='/usr/bin'; C:\_32\pscrpt>
One potential annoyance with setting the perl5opt environment variable system-wide is that every perl on the system needs to be able to load a


Replies are listed 'Best First'.
Re^2: changing vaules in perl -V
by xorl (Deacon) on Mar 20, 2013 at 12:44 UTC

    This is definitely along the lines of what I want to do.

    I put the file in ~/perl_libs, removed everything I could find related to cpanm, and changed my install line to be:

    wget -O- | /usr/bin/perl -I /home/xorl/perl_libs -MC +onfig_m - App::cpanminus -f
    (-f to force a reinstall)

    Unfortunately it is still installing in the wrong place.

    /usr/bin/perl -I /home/xorl/perl_libs -MConfig_m -MConfig -e 'print $Config{"installsitebin"} . "\n";' gives the "correct" value (/usr/bin). So I'm not sure what is going on at this point.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024400]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-05-23 15:21 GMT
Find Nodes?
    Voting Booth?