Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight


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 E.g. say that I wanted to change $Config{startperl}, is there a more robust way than regular expressions on's source?


Replies are listed 'Best First'.
Re: Editing
by syphilis (Bishop) 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 with altered values it might be safer to use ExtUtils::FakeConfig. It creates a 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.

      That was exactly what I needed. Thanks!
Re: Editing
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
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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-11-24 10:22 GMT
Find Nodes?
    Voting Booth?

    No recent polls found