The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DNS::ZoneFile::Record - single DNS record in a zone database

SYNOPSIS

use DNS::ZoneFile::Record;

$rec=DNS::ZoneFile::Record->new(origin,name,type,data...);

$name=$rec->Name(name);

$type=$rec->Type(type);

$address=$rec->Addr(address);

$serial=$rec->Serial(serialno);

$mxcost=$rec->MXCost(MXcost);

@record=$rec->getRecord();

DESCRIPTION

DNS::ZoneFile::Record is a companion object model to DNS::ZoneFile to provide a seperate object and methods for each of the records in a zone.

The object methods are as follows:

new(origin,name,type,data...)

The new method is to create a new object. origin is used for the value of the $ORIGIN system in the database, so that the record can be canonicalised. name is the name relative to origin, or ending in a period ('.') is the canonical name for this record. type is the type of this record, and affects what data the new method expects, and how it stores it internally. Valid types are:

SOA

This is a start of authority record, and expects 7 data arguments, in order the host, the hostmaster, the serial number, the refresh time, the retry time, the expiry time and the minimum time to live of the records.

NS

This is a nameserver record, detailing nameservers for a domain. This just expects one data argument viz the name of the server.

A

This is a forward record, pointing a name to an IP address, so the data argument expected is a dotted quad IP address.

PTR

This is a reverse record, only really valid in .in-addr.arpa domains, and points a number to a name.

MX

This is a mail exchanger record. The arguments expected are in order the cost of using that server (or reverse priority) and the name of the server.

CNAME

This is a canonical name record, it points one name as a redirector for another. Its one data argument is the name to point to.

Name(name)

Returns the full DNS name of the record, also sets the name if an argument is provided.

Type(type)

Returns the type of the record, also sets the type if an argument is provided, although at present this is not recommended, because no data is moved internally, so things could break.

Addr(addr)

Returns the address that this record points to, this differs in meaning depending on the record type, the main difference being in the start of authority records, where the address returned is the authoritative host for this zone. This value can also be set with the optional argument.

Serial(serialno)

Returns the serial number of the zone file if this is an SOA record, also sets it if an argument is provided.

MXCost(MXcost)

Returns the cost of this server if this is an MX record, also sets it if an argument is provided.

getRecord()

Returns the data for this record in the order that it was input (see above new() method).

COMMENTS

This is currently alpha software, internal structures are likely to change at any time.

AUTHOR

Matthew Byng-Maddick <matthew@codix.net>

SEE ALSO

DNS::ZoneFile