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."