Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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


Comment on Re: changing vaules in perl -V
Select or Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-11-28 15:59 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls