Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: changing vaules in perl -V

by syphilis (Canon)
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 Config_m.pm 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 Config_m.pm 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 Config_m.pm.

Cheers,
Rob


Comment on Re: changing vaules in perl -V
Select or Download Code
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 Config_m.pm file in ~/perl_libs, removed everything I could find related to cpanm, and changed my install line to be:

    wget -O- http://cpanmin.us | /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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024400]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2015-07-01 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (22 votes), past polls