P is for Practical | |
PerlMonks |
Practical suggestion for accessing configuration data stored in XML formatby fuzzycow (Sexton) |
on Mar 18, 2003 at 15:08 UTC ( [id://244007]=perlmeditation: print w/replies, xml ) | Need Help?? |
During one of my recent perl programming projects I needed a way to store configuration for module instance creation. I chose XML as a format for configuration storage and stated looking for a suitable module for reading XML files. Very soon I discovered there was no existing module that satisfied my requirements: 1. Very concise usage syntax 2. Integrate-able with perl OO 3. Sane treatment of multi-value results
I'll skip some history here, but let's just say that I've ended-up writing proof-of-concept perl module (XML::Twig wrapper) based on the idea of AUTOLOAD'ing methods based on element tag names. I'm well aware of the downsides of this approach, but I suggest you look at the examples below before you start 'flaming' ;) I know you can get simular results with XPath, but that IMHO is not well suited for configuration parsing. If anybody is interested I'll try to release the module source on CPAN.
Back to
Meditations
|
|