laziness, impatience, and hubris | |
PerlMonks |
Net::DNS::ZonFile and DBIby sunadmn (Curate) |
on Apr 15, 2004 at 14:42 UTC ( [id://345396]=perlquestion: print w/replies, xml ) | Need Help?? |
sunadmn has asked for the wisdom of the Perl Monks concerning the following question:
Good morning all first I would like to thank all the monks who have put up with me this week in my quest for knowldge I know I have some silly questions at times, but I promise it is just in the quest to better understand the wonders of perl. Anyway on to my battle I have been working with various DNS mods to parse over 30,000 zone files i have on my DNS system to get the data into a mySQL DB for managment and I thought I had this one whipped, but I have come across an issue that for the life of me I can't figure out and come to you all for help.
After some playing and hacking of the mods I have decided that my best fit will be Net::DNS::ZoneFile for this task, now the issue I have is that I want to only parse certain zone files for certain data ( A CNAME MX NS PTR ) now for the most part I have my other scripts working the only two I have trouble with are the scripts for forward records ( A ) and reverse ( PTR ). The mod understands the standards in Bind for RR types and has added functionality for the special $GENERATE and $INCLUDE. The issue I run into with the code below is that when I parse for forward and reverse data with my test to m/^A/ or m/PTR/ is that once the file is loaded and the parse begins once the read finds a line with the $GENERATE on it the script hangs and doesn't know what to do. I have done testing to see what the mod is doing and calls to to build the record {type} and that produces A NS CNAME MX PTR but doesn't match the $GENERATE, so the issue I have is how do I test for that and then build that data so I may insert into my DB. In the Net::DNS::ZoneFile ZoneFile.pm the sub _parse seems to build the data on the fly ( please see the sub for this ) so I know that the test for {type} wont work here and I am at my wits end as how to make this work for both standard records and the special $GENERATE if anyone could please help me out as I am loosing much hair over this one. Below is my code so far. And here is the section from the ZoneFile.pm for the $GENERATE handling. SUNADMN USE PERL
Back to
Seekers of Perl Wisdom
|
|