Obsolete
/
dnsmanagerv1
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
dnsmanagerv1/lib/zonefile.pm

53 lines
1.1 KiB
Perl
Raw Normal View History

package zonefile;
use v5.14;
use Moo;
use DNS::ZoneParse;
has zone => qw/is rw/ ;
has [ qw/domain/ ] => qw/ is ro required 1/;
has [ qw/zonefile/ ] => qw/ is rw required 1/;
sub BUILD {
my ($self) = @_;
my $filename = $$self{zonefile};
if($filename =~ "://")
{
my $fileuri = URI->new($filename);
$filename = $fileuri->path;
}
$$self{zone} = DNS::ZoneParse->new($filename, $$self{domain});
}
sub new_serial {
my $self = shift;
$self->zone->new_serial();
}
sub origin {
my $self = shift;
$self->zone->origin();
}
sub output {
my $self = shift;
$self->zone->output();
}
sub dump {
my $self = shift;
$self->zone->dump();
}
# better encapsulation
sub a { my $self = shift; $self->zone->a }
sub aaaa { my $self = shift; $self->zone->aaaa }
sub cname { my $self = shift; $self->zone->cname }
sub ns { my $self = shift; $self->zone->ns }
sub mx { my $self = shift; $self->zone->mx }
sub ptr { my $self = shift; $self->zone->ptr }
sub txt { my $self = shift; $self->zone->txt } # TODO TEST THIS
1;