1package Net::DNS::RR::MINFO; 2# 3# $Id: MINFO.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->{"rmailbx"}, $offset) = Net::DNS::Packet::dn_expand($data, $offset); 19 ($self->{"emailbx"}, $offset) = Net::DNS::Packet::dn_expand($data, $offset); 20 } 21 22 return bless $self, $class; 23} 24 25sub new_from_string { 26 my ($class, $self, $string) = @_; 27 28 if ($string && ($string =~ /^(\S+)\s+(\S+)$/)) { 29 $self->{"rmailbx"} = $1; 30 $self->{"emailbx"} = $2; 31 $self->{"rmailbx"} =~ s/\.+$//; 32 $self->{"emailbx"} =~ s/\.+$//; 33 } 34 35 return bless $self, $class; 36} 37 38sub rdatastr { 39 my $self = shift; 40 41 return $self->{"rmailbx"} 42 ? "$self->{rmailbx}. $self->{emailbx}." 43 : ''; 44} 45 46sub rr_rdata { 47 my ($self, $packet, $offset) = @_; 48 my $rdata = ""; 49 50 if (exists $self->{"rmailbx"}) { 51 $rdata .= $packet->dn_comp($self->{"rmailbx"}, $offset); 52 53 $rdata .= $packet->dn_comp($self->{"emailbx"}, 54 $offset + length $rdata); 55 } 56 57 return $rdata; 58} 59 60 61sub _canonicalRdata { 62 my ($self, $packet, $offset) = @_; 63 my $rdata = ""; 64 65 if (exists $self->{"rmailbx"}) { 66 $rdata .= $self->_name2wire(lc($self->{"rmailbx"})); 67 $rdata .= $self->_name2wire(lc($self->{"emailbx"})); 68 } 69 70 return $rdata; 71} 72 73 741; 75__END__ 76 77=head1 NAME 78 79Net::DNS::RR::MINFO - DNS MINFO resource record 80 81=head1 SYNOPSIS 82 83C<use Net::DNS::RR>; 84 85=head1 DESCRIPTION 86 87Class for DNS Mailbox Information (MINFO) resource records. 88 89=head1 METHODS 90 91=head2 rmailbx 92 93 print "rmailbx = ", $rr->rmailbx, "\n"; 94 95Returns the RR's responsible mailbox field. See RFC 1035. 96 97=head2 emailbx 98 99 print "emailbx = ", $rr->emailbx, "\n"; 100 101Returns the RR's error mailbox field. 102 103=head1 COPYRIGHT 104 105Copyright (c) 1997-2002 Michael Fuhr. 106 107Portions Copyright (c) 2002-2004 Chris Reinhardt. 108 109All rights reserved. This program is free software; you may redistribute 110it and/or modify it under the same terms as Perl itself. 111 112=head1 SEE ALSO 113 114L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>, 115L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>, 116RFC 1035 Section 3.3.7 117 118=cut 119