home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / RP.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-04  |  2.3 KB  |  117 lines

  1. package Net::DNS::RR::RP;
  2. #
  3. # $Id: RP.pm,v 2.101 2004/01/04 04:31:10 ctriv Exp $
  4. #
  5. use strict;
  6. use vars qw(@ISA $VERSION);
  7.  
  8. use Net::DNS::Packet;
  9.  
  10. @ISA     = qw(Net::DNS::RR);
  11. $VERSION = (qw$Revision: 2.101 $)[1];
  12.  
  13. sub new {
  14.     my ($class, $self, $data, $offset) = @_;
  15.  
  16.     if ($self->{"rdlength"} > 0) {
  17.         ($self->{"mbox"},     $offset) = Net::DNS::Packet::dn_expand($data, $offset);
  18.         ($self->{"txtdname"}, $offset) = Net::DNS::Packet::dn_expand($data, $offset);
  19.     }
  20.  
  21.     return bless $self, $class;
  22. }
  23.  
  24. sub new_from_string {
  25.     my ($class, $self, $string) = @_;
  26.  
  27.     if ($string && ($string =~ /^(\S+)\s+(\S+)$/)) {
  28.         $self->{"mbox"}     = $1;
  29.         $self->{"txtdname"} = $2;
  30.         $self->{"mbox"}     =~ s/\.+$//;
  31.         $self->{"txtdname"} =~ s/\.+$//;
  32.     }
  33.  
  34.     return bless $self, $class;
  35. }
  36.  
  37. sub rdatastr {
  38.     my $self = shift;
  39.  
  40.     return $self->{"mbox"} ? "$self->{mbox}. $self->{txtdname}." : '';
  41. }
  42.  
  43. sub rr_rdata {
  44.     my ($self, $packet, $offset) = @_;
  45.     my $rdata = "";
  46.  
  47.     if (exists $self->{"mbox"}) {
  48.         $rdata .= $packet->dn_comp($self->{"mbox"}, $offset);
  49.         $rdata .= $packet->dn_comp($self->{"txtdname"},
  50.                        $offset + length $rdata);
  51.     }
  52.  
  53.     return $rdata;
  54. }
  55.  
  56.  
  57. sub _canonicalRdata {
  58.     my $self  = shift;
  59.     my $rdata = "";
  60.     
  61.     if (exists $self->{"mbox"}) {
  62.         $rdata .= $self->_name2wire($self->{"mbox"});
  63.         $rdata .= $self->_name2wire($self->{"txtdname"});
  64.     }
  65.  
  66.     return $rdata;
  67. }
  68.  
  69.  
  70.  
  71. 1;
  72. __END__
  73.  
  74. =head1 NAME
  75.  
  76. Net::DNS::RR::RP - DNS RP resource record
  77.  
  78. =head1 SYNOPSIS
  79.  
  80. C<use Net::DNS::RR>;
  81.  
  82. =head1 DESCRIPTION
  83.  
  84. Class for DNS Responsible Person (RP) resource records.
  85.  
  86. =head1 METHODS
  87.  
  88. =head2 mbox
  89.  
  90.     print "mbox = ", $rr->mbox, "\n";
  91.  
  92. Returns a domain name that specifies the mailbox for the responsible person.
  93.  
  94. =head2 txtdname
  95.  
  96.     print "txtdname = ", $rr->txtdname, "\n";
  97.  
  98. Returns a domain name that specifies a TXT record containing further
  99. information about the responsible person.
  100.  
  101. =head1 COPYRIGHT
  102.  
  103. Copyright (c) 1997-2002 Michael Fuhr. 
  104.  
  105. Portions Copyright (c) 2002-2003 Chris Reinhardt.
  106.  
  107. All rights reserved.  This program is free software; you may redistribute
  108. it and/or modify it under the same terms as Perl itself.
  109.  
  110. =head1 SEE ALSO
  111.  
  112. L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
  113. L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
  114. RFC 1183 Section 2.2
  115.  
  116. =cut
  117.