Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Editing Config.pm

by rvosa (Curate)
on Aug 31, 2006 at 21:41 UTC ( #570684=perlquestion: print w/ replies, xml ) Need Help??
rvosa has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,

is there a programmatic interface to Config.pm? E.g. say that I wanted to change $Config{startperl}, is there a more robust way than regular expressions on Config.pm's source?

Thanks!

Comment on Editing Config.pm
Download Code
Re: Editing Config.pm
by diotalevi (Canon) on Aug 31, 2006 at 22:15 UTC

    I'd be leary of this idea. This informs XS stuff how your perl was compiled. Don't break it.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      I know. I'm certainly not planning to stick my hands in the defines etc., but I may want to change installation paths to relocate an installation.
Re: Editing Config.pm
by syphilis (Canon) on Aug 31, 2006 at 23:32 UTC
    Not sure that this applies to what you want to do:
    use warnings; use strict; use Config; my $obj = tied %Config::Config; print $Config::Config{startperl}, "\n"; $obj->{startperl} = "garbage"; print $Config::Config{startperl}, "\n"; __END__ outputs: #!perl garbage

    That's a technique used by ExtUtils::FakeConfig. If you want a hard coded Config.pm with altered values it might be safer to use ExtUtils::FakeConfig. It creates a Config_m.pm with the overwritten Config values. If you want to use those overwritten values, you invoke perl with '-MConfig_m'. Otherwise the original Config values are used. ExtUtils::FakeConfig was written with a view to overwriting some specific Config values, but I think it can fairly easily be generalised. Could be worth a look.

    Cheers,
    Rob
      That was exactly what I needed. Thanks!
Re: Editing Config.pm
by jacques (Priest) on Sep 01, 2006 at 00:25 UTC
    ... And if you want to see *all* of the values in the Config hash in a nicely formatted HTML page:
    use HTML::Perlinfo; perlinfo(INFO_CONFIG);

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (12)
As of 2014-07-10 22:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls