Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Substituting tokens into configuration values

by zby (Vicar)
on Mar 20, 2003 at 13:34 UTC ( [id://244582]=note: print w/replies, xml ) Need Help??


in reply to Substituting tokens into configuration values

For me the simplest approach to configuration files is to use perl syntax - and than directly build the datastructures by an eval. The substitution problem would be solved by an asignemnt in the built datastructure - something like this:
$config->{general-schedule} = $general-schedule-config
Where the $general-schedule-config was built by an eval as well.

Replies are listed 'Best First'.
Re: Re: Substituting tokens into configuration values
by crouchingpenguin (Priest) on Mar 20, 2003 at 14:33 UTC

    You can also use do to accomplish the same thing. Here is a simple example:

    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; our $config; do '/tmp/config.pl'; print Dumper(\$config),"\n";

    and /tmp/config.pl looks like:

    $config = [ option1 => 'one', option2 => 'two', option3 => 'three' ];

    It might also be advantagous to setup a signal handler (or whatever means/mechanism available as a win service) that will reread the config.


    cp
    ----
    "Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://244582]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-19 15:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found