WANT TO GO HOME!

Simon on 2002-07-03T17:14:29

I want to go home, but I've got started hacking a really neat little Perl module, and I've only got two subroutines left to do. In fact, stuff it, I'm going home. I can finish this off tomorrow.

So, about the module. It's called Config::Auto, and I've written it because I never want to write another config file parser ever again. So, this little baby looks around for a likely-looking config file, sniffs it to work out what sort of format it's in, and has a good shot at parsing it into a Perl data structure. It deals with XML, INI files, Perl files, lists and the more "vague" Unix-style colon-separated, equal-separated and space-separated files.

For instance: # tortuous.pl use Config::Auto; use Data::Dumper; print Dumper(Config::Auto::parse());

This looks around my filesystem, and finds .tortuousrc, which looks like this: test: foo=bar, baz=quuz test2: blah blez: quux And, with no other prompting, it comes back with: $VAR1 = { 'test2' => 'blah', 'blez' => 'quux', 'test' => { 'foo' => 'bar', 'baz' => 'quuz' } }; Laziness: check.
Impatience: check.
Hubris: check.


Obligatory Ameri-centric ignorance post

jdavidb on 2002-07-03T19:20:04

But wait, you can't finish it tomorrow, because that's a holiday! <stupid-grin/>

Parsing

pudge on 2002-07-05T18:49:28

Did you use YAML?

FWIW, I write my config files *in* Perl, and just do/require them.  :-) I do like where you're going here, though  ...