Re: Perl

From: Greg Oster <oster_at_no.spam.please>
Date: Thu Jul 20 2006 - 15:52:10 CST

"Steven Kurylo" writes:
> Here is the problem. I have a large hash which looks something like this:
>
> %networks = (
> 'name' => {
> filter => 'net 10.10.10.0/21',
> port => '234',
> },
> );
>
> I've put it in a file and I include it in my main program; so I'm
> using the hash as a cheap config file. Now I have so many entries, I
> want to mass import new entires. Before I write a program which
> writes perl code, is there something better?
>
> I've been poking around for a config module that will give me a hash
> of hashes, or a module which will write a hash to perl code.
> Suggestions? Thanks

Take a step back from things, and let the code be code, and the data
be data? (vs. doing the "data as code"?) (i.e. define a format for
a configuration file, and read+parse that file to build up %networks )

Once you decide on a format for the config/data file, it'd be easy to
write a perl script to convert your existing "data as code" into just
the necessary data bits :)

Later...

Greg Oster
Received on Thu Jul 20 15:52:21 2006

This archive was generated by hypermail 2.1.8 : Fri Sep 08 2006 - 23:26:38 CST