|go ahead... be a heretic|
Parsing Zonefilesby Elijah_A (Novice)
|on Aug 05, 2004 at 05:55 UTC||Need Help??|
Elijah_A has asked for the
wisdom of the Perl Monks concerning the following question:
Anyone here worked on dns zonefiles? I need some advice... I have some scripts that poll our dns frontend database for updated/new/deleted dns entries. They grab 'em just fine and dump them all together in a temporary file.
I need to be able to update the main zonefile using the temporary file. But everytime the script polls and dump more dns updates to temp, there may be a problem of adding (updated)duplicate entries to the main zonefile.
The old entries in the main zonefile must be updated, but how do I do that? I tried a variety of modules (DNS::Zone::File) but I couldn't get them to work right.
Here's a sample entry from the temp file:
There are hundreds of these entries in one zonefile, I simply need to find specific entries from the main zonefile to be updated. I can't just keep appending to it, duplicates might sneek in.
Update: I've decided to use Net::DNS::ZoneFile(I'd have some use for the temp file with this) and hash as one of the monks suggested. But I'm having some trouble printing the objects using Net::DNS::ZoneFile.