NAME

TinyDNS::Reader::Merged - Read a TinyDNS file and merge records.

DESCRIPTION

The TinyDNS::Reader module will allow you to parse a TinyDNS zonefile, into a number of distinct records, one for each line.

However there is no handling the case where you'd expect a single DNS value to have multiple values.

For example if you were to parse this file you would get two records:

db.example.com:1.2.3.4:300
db.example.com:10.20.30.40:300

On a purely record-by-record basis that is as-expected, however when you actually come to manipulate your DNS records you'd expect to have a single logical object with values something like this:

{
  'ttl' => '300',
  'value' => [
               '1.2.3.4',
               '10.20.30.40'
             ],
  'name' => 'db.example.com',
  'type' => 'A'
},

This module takes care of that for you, by merging records which consist of identical "name" + "type" pairs.

Use it as a drop-in replacing for TinyDNS::Reader.

METHODS

new

Constructor.

This module expects to be given a file parameter, pointing to a file which can be parsed, or a text parameter containing the text of the records to parse.

parse

Parse the records and return a merged set.

The parsing is delegated to TinyDNS::Reader, so all supported record-types work as expected.

AUTHOR

Steve Kemp <steve@steve.org.uk>

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 Steve Kemp <steve@steve.org.uk>.

This code was developed for an online Git-based DNS hosting solution, which can be found at:

  • https://dns-api.com/

This library is free software. You can modify and or distribute it under the same terms as Perl itself.