Hi Elijah_A:
I believe the problem might be your source file. Are you sure it is a real BIND zone? Your example does not have a SOA record, which might be ok for your scenario.
On my side, the code below (slight modification of yours)...
#!/usr/bin/perl
use strict;
use warnings;
use Net::DNS;
use Net::DNS::ZoneFile;
my $rrset = Net::DNS::ZoneFile->readfh(*DATA);
print "Just read:\n";
print $_->string, "\n" for @$rrset;
push @$rrset, new Net::DNS::RR "3 7200 IN PTR gov.ph.";
foreach (@$rrset)
{
next unless $_->type eq 'SOA' and $_->class eq 'IN';
$_->serial($_->serial + 1);
}
print "After adding one to the SOA's serial:\n";
print $_->string, "\n" for @$rrset;
__DATA__
; Sta. Magdalena, Sorsogon
; Created by GovPh: Fri Aug 6 13:02:54 2004
stamagdalena IN NS ncc.xx.gov.ph
IN NS ncc.xx.gov.ph
Produces the following output...
Just read:
stamagdalena. 0 IN NS ncc.xx.gov.ph.
stamagdalena. 0 IN NS ncc.xx.gov.ph.
After adding one to the SOA's serial:
stamagdalena. 0 IN NS ncc.xx.gov.ph.
stamagdalena. 0 IN NS ncc.xx.gov.ph.
3. 7200 IN PTR gov.ph.
I would check the source file for extraneous characters. For the record, this is what I'm running on my side:
$ perl -MNet::DNS::ZoneFile -e 'print $Net::DNS::ZoneFile::VERSION, "\n"'
1.10
$ perl -v | egrep darwin
This is perl, v5.8.1 built for darwin
Best regards
-lem, but some call me fokat
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|