Re: Perl

From: Dave Hall <dave-slg_at_no.spam.please>
Date: Thu Jul 20 2006 - 17:32:05 CST

On Thu, Jul 20, 2006 at 04:14:15PM -0700, Steven Kurylo wrote:
> >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 :)
>
> Right, thats why I was looking for a simple config module to use.
> Though none of them seem to be able to do nested hashes.
>
> So yeah instead of writing some code to create perl code, it might be
> easier to write some code to make my own config module.
>
> It looks like Config::General might be able to do what I want.

Perhap XML might help here. XML can provide a more-or-less human readable,
human editable nested structure. You could then write code to walk the DOM
tree and create a data structure or you could use XSLT to translate the XML
into perl code (this is really easy). The cost is a small investment
learning to write well-formed XML (easy if you've written XHTML) and XSL's
(XML with some programming constructs).

There may already be code to go from XML into a perl hash, I've never had to
do it in perl.
Received on Thu Jul 20 17:32:23 2006

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