in reply to XML for Dummies

You're overengineering this. XML buys you nothing useful in this case.

Write a bash script that does nothing but set these 8-10 variables. Modify your existing bash scripts to source this new configuration script. Write a Perl function to parse this configuration script. Put that in a library, and in all of your Perl scripts load that library and call that function.

Now you're done in the simplest manner possible. And the next person who has to pick up your code should find it easy to understand.

Replies are listed 'Best First'.
Re^2: XML for Dummies
by massa (Hermit) on Jul 12, 2008 at 09:21 UTC
    Better yet: use Config::File, Config::General, Config::IniFile, Config::Tiny or Config::Any. IMHO it's never a good idea to roll your own config file parsing, when you have many CPAN modules to do the heavy lifting for you. With Config::Any you can even use XML config files if necessary.
    []s, HTH, Massa
      You missed the requirement that the configuration be accessible in 2 different languages. A CPAN module will not help a bash script.

      As for configuration file parsing, I'm not a fan of anything that I've seen on CPAN yet. Admittedly I haven't looked in years, but I still hold to the opinion that I expressed in Re (tilly) 6: using strict and a config file.

        Config::Any (what I personally use) will read a file with only keys=values (it will consider it as an INI file, without "directories") and in bash, you just source such a file.

        IIRC you can't read a .xml file under bash, either, so XML is kind of off-limits for said requirement. I respect your opinion, but I still think that inventing the wheel for reading config files is a waste of time.

        As for your mentioned post, my configs do all four items you put there, just loading with Config::Any and traversing in the appropriate order.

        []s, HTH, Massa