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 / CNAME.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-04  |  1.8 KB  |  97 lines

  1. package Net::DNS::RR::CNAME;
  2. #
  3. # $Id: CNAME.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->{"cname"}) = 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->{"cname"} = $string;
  29.     }
  30.  
  31.     return bless $self, $class;
  32. }
  33.  
  34. sub rdatastr {
  35.     my $self = shift;
  36.  
  37.     return $self->{"cname"} ? "$self->{cname}." : '';
  38. }
  39.  
  40. sub rr_rdata {
  41.     my ($self, $packet, $offset) = @_;
  42.     my $rdata = "";
  43.  
  44.     if (exists $self->{"cname"}) {
  45.         $rdata = $packet->dn_comp($self->{"cname"}, $offset);
  46.     }
  47.  
  48.     return $rdata;
  49. }
  50.  
  51. # rdata contains a compressed domainname... we should not have that.
  52. sub _canonicalRdata {    
  53.     my ($self) = @_;
  54.  
  55.     return $self->_name2wire($self->{"cname"});
  56. }
  57.  
  58. 1;
  59. __END__
  60.  
  61. =head1 NAME
  62.  
  63. Net::DNS::RR::CNAME - DNS CNAME resource record
  64.  
  65. =head1 SYNOPSIS
  66.  
  67. C<use Net::DNS::RR>;
  68.  
  69. =head1 DESCRIPTION
  70.  
  71. Class for DNS Canonical Name (CNAME) resource records.
  72.  
  73. =head1 METHODS
  74.  
  75. =head2 cname
  76.  
  77.     print "cname = ", $rr->cname, "\n";
  78.  
  79. Returns the RR's canonical name.
  80.  
  81. =head1 COPYRIGHT
  82.  
  83. Copyright (c) 1997-2002 Michael Fuhr. 
  84.  
  85. Portions Copyright (c) 2002-2003 Chris Reinhardt.
  86.  
  87. All rights reserved.  This program is free software; you may redistribute
  88. it and/or modify it under the same terms as Perl itself.
  89.  
  90. =head1 SEE ALSO
  91.  
  92. L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
  93. L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
  94. RFC 1035 Section 3.3.1
  95.  
  96. =cut
  97.