Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Editing Config.pm

by rvosa (Curate)
on Aug 31, 2006 at 21:41 UTC ( [id://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!

Replies are listed 'Best First'.
Re: Editing Config.pm
by syphilis (Archbishop) 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);
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-29 00:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found