Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister


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 (Chancellor) 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
[thepkd]: Yes this is my first time in cb. Trying to work my way around.
[JohnCub]: "A ref too far" would make a good title for anyone's perl memoirs
[thepkd]: Anyways it works with $aohoaoh[0]->{'foo '}[0]->{'bar'}
[GotToBTru]: "I did it my $way"
[JohnCub]: I hope $way isn't a hashref. ;)
[GotToBTru]: many times i've been told I made a real hash of thiings
[GotToBTru]: so .. perhaps it should b e

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2016-12-06 13:48 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (105 votes). Check out past polls.