1package Net::DNS::RR::PTR;
2#
3# $Id: PTR.pm 632 2007-03-12 13:24:21Z olaf $
4#
5use strict;
6BEGIN {
7    eval { require bytes; }
8}
9use vars qw(@ISA $VERSION);
10
11@ISA     = qw(Net::DNS::RR);
12$VERSION = (qw$LastChangedRevision: 632 $)[1];
13
14sub new {
15	my ($class, $self, $data, $offset) = @_;
16
17	if ($self->{"rdlength"} > 0) {
18		($self->{"ptrdname"}) = Net::DNS::Packet::dn_expand($data, $offset);
19	}
20
21	return bless $self, $class;
22}
23
24sub new_from_string {
25	my ($class, $self, $string) = @_;
26
27	if ($string) {
28		$string =~ s/\.+$//;
29		$self->{"ptrdname"} = $string;
30	}
31
32	return bless $self, $class;
33}
34
35sub rdatastr {
36	my $self = shift;
37
38	return $self->{"ptrdname"} ? "$self->{ptrdname}." : '';
39}
40
41sub rr_rdata {
42	my ($self, $packet, $offset) = @_;
43	my $rdata = "";
44
45	if (exists $self->{"ptrdname"}) {
46		$rdata .= $packet->dn_comp(lc($self->{"ptrdname"}), $offset);
47	}
48
49	return $rdata;
50}
51
52sub  _canonicalRdata {
53	my ($self, $packet, $offset) = @_;
54	my $rdata = "";
55
56	if (exists $self->{"ptrdname"}) {
57		$rdata .= $self->_name2wire($self->{"ptrdname"});
58	}
59
60	return $rdata;
61}
62
631;
64__END__
65
66=head1 NAME
67
68Net::DNS::RR::PTR - DNS PTR resource record
69
70=head1 SYNOPSIS
71
72C<use Net::DNS::RR>;
73
74=head1 DESCRIPTION
75
76Class for DNS Pointer (PTR) resource records.
77
78=head1 METHODS
79
80=head2 ptrdname
81
82    print "ptrdname = ", $rr->ptrdname, "\n";
83
84Returns the domain name associated with this record.
85
86=head1 COPYRIGHT
87
88Copyright (c) 1997-2002 Michael Fuhr.
89
90Portions Copyright (c) 2002-2004 Chris Reinhardt.
91
92All rights reserved.  This program is free software; you may redistribute
93it and/or modify it under the same terms as Perl itself.
94
95=head1 SEE ALSO
96
97L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
98L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
99RFC 1035 Section 3.3.12
100
101=cut
102