Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Substituting tokens into configuration values

by Jenda (Abbot)
on Mar 20, 2003 at 14:06 UTC ( [id://244590]=note: print w/replies, xml ) Need Help??


in reply to Substituting tokens into configuration values

If you would not insist on Config::IniFile ...

use Config::IniHash; $config = ReadINI( 'Service.ini', systemvars => 0, # do not expand system %variables% case => 'preserve', # lookup is case insensitive. keys %$INI return the original case # ! if you change this option to a case sensitive one even the %se +ction-name% variables will be case sensitive ! forValue => sub { my ($name, $value, $sectionname, $INI) = @_; $value =~ s/%(\w+)-(\w+)%/$INI->{$1}->{$2}/g; return $value; }, ); use Data::Dumper; print Dumper($config);

As you see you get a HoH containing the data from the INI file and you can "preprocess" the values before inserting them to the HoH.

HTH, Jenda

P.S.: To continue the shameless plug ... did you consider using PerlApp and Win32::Daemon::Simple?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found