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 / DNAME.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-04  |  1.6 KB  |  90 lines

  1. package Net::DNS::RR::DNAME;
  2. #
  3. # $Id: DNAME.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->{"dname"}) = Net::DNS::Packet::dn_expand($data, $offset);
  18.     }
  19.  
  20.     return bless $self, $class;
  21. }
  22.  
  23. sub new_from_string {
  24.     my ($class, $self, $string) = @_;
  25.  
  26.     if ($string) {
  27.         $string =~ s/\.+$//;
  28.         $self->{"dname"} = $string;
  29.     }
  30.  
  31.     return bless $self, $class;
  32. }
  33.  
  34. sub rdatastr {
  35.     my $self = shift;
  36.  
  37.     return $self->{"dname"} ? "$self->{dname}." : '';
  38. }
  39.  
  40. sub rr_rdata {
  41.     my ($self, $packet, $offset) = @_;
  42.     my $rdata = "";
  43.  
  44.     if (exists $self->{"dname"}) {
  45.         $rdata = $packet->dn_comp($self->{"dname"}, $offset);
  46.     }
  47.  
  48.     return $rdata;
  49. }
  50.  
  51. 1;
  52. __END__
  53.  
  54. =head1 NAME
  55.  
  56. Net::DNS::RR::DNAME - DNS DNAME resource record
  57.  
  58. =head1 SYNOPSIS
  59.  
  60. C<use Net::DNS::RR>;
  61.  
  62. =head1 DESCRIPTION
  63.  
  64. Class for DNS Non-Terminal Name Redirection (DNAME) resource records.
  65.  
  66. =head1 METHODS
  67.  
  68. =head2 dname
  69.  
  70.     print "dname = ", $rr->dname, "\n";
  71.  
  72. Returns the DNAME target.
  73.  
  74. =head1 COPYRIGHT
  75.  
  76. Copyright (c) 1997-2002 Michael Fuhr. 
  77.  
  78. Portions Copyright (c) 2002-2003 Chris Reinhardt.
  79.  
  80. All rights reserved.  This program is free software; you may redistribute
  81. it and/or modify it under the same terms as Perl itself.
  82.  
  83. =head1 SEE ALSO
  84.  
  85. L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
  86. L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
  87. RFC 2672
  88.  
  89. =cut
  90.