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

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 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.