XP is just a number | |
PerlMonks |
Config file parsing tutorial?by tombmbdil (Beadle) |
on Feb 17, 2003 at 21:26 UTC ( [id://236122]=perlquestion: print w/replies, xml ) | Need Help?? |
tombmbdil has asked for the wisdom of the Perl Monks concerning the following question:
Wise Monks, I spend much of my time mucking about with dhcp data. I'm also in the process of trying to learn OO perl. So, I figured I would practice my class-building skills by creating a DHCP module for myself which will gather various lease/network information. I find parsing the dhcpd.leases file to be pretty easy because the data is nice and predictable. The human-generated dhcpd.conf file, on the other hand, is a nightmare. I have figured out a way to gather some of the information I need, but I know there must be some established algorithm that is much more elegant. I've browsed a few of the configuration file parsing modules on cpan to search for ideas, but either they aren't sufficiently commented, or they deal with simpler configuration schemes (as far as I can tell). Does anyone know of an online tutorial somewhere that covers configuration file parsing algorithms?
The current bit of code I have works for what I need right now, but I know it's extremely oversimplified and prone to break under various conditions. Here's a simplified snippet of what I have:
--------------------------
Back to
Seekers of Perl Wisdom
|
|