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_mWith 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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.