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:
; The Foreign Service Institute ; Created by GovPh: Thu Aug 5 07:51:07 2004 fsi IN NS tayxxxn.ino.com.ph IN NS monumxxo.ino.com.ph IN NS tayxxxn.ino.com.ph IN NS monumxxo.ino.com.ph IN NS tayxxxn.ino.com.ph IN NS monumxxo.ino.com.ph

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.

Elijah

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.

In reply to Parsing Zonefiles by Elijah_A

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.