DNS::ZoneParse has an undocumented $ORIGIN
I was working writing a few scripts that should update a DNS zone file on the fly. I decided to use the DNS::ZoneParse perl module for convenience.
The example there is straightforward for changing MX records so I thought modifying it to change an A record should be a piece of cake. Right? Wrong!
For the love of it I couldn’t get my code to modify the record in question, it would always delete it.
All the beer in the world goes to this guy who found the reason. Basically if the ORIGIN method is not set the record won’t be written to the new file.
So, changing for example the record like this will actually erase it
$a->[i] = { host => 'blah.com',
class => 'IN',
ttl => '1m',
name => '@' };
and like this it will work:
$origin='host.domain.com.';
$a->[i] = { ORIGIN => $origin,
host => 'blah.com',
class => 'IN',
ttl => '1m',
name => '@' };