| 1 | package Net::RRP::Entity::NameServer; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Net::RRP::Entity; | ||
| 5 | use Net::RRP::Exception::InvalidAttributeName; | ||
| 6 | @Net::RRP::Entity::NameServer::ISA = qw(Net::RRP::Entity); | ||
| 7 | $Net::RRP::Entity::NameServer::VERSION = '0.1'; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Net::RRP::Entity::NameServer - rrp domain entity representation. | ||
| 12 | |||
| 13 | =head1 SYNOPSIS | ||
| 14 | |||
| 15 | use Net::RRP::Entity::NameServer; | ||
| 16 | my $nameServerEntity = new Net::RRP::Entity::NameServer ( NameServer => [ 'ns1.domain.ru' ], | ||
| 17 | IPAddress => [ '1.1.1.1' ] ); | ||
| 18 | my $nameServerEntity1 = new Net::RRP::Entity::NameServer (); | ||
| 19 | $nameServerEntity1->setAttribute ( NameServer => [ 'ns1.domain.ru' ] ); | ||
| 20 | $nameServerEntity1->setAttribute ( IPAddress => [ '1.1.1.1' ] ); | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This is a rrp name server entity representation class. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | =head2 getName | ||
| 29 | |||
| 30 | return a 'NameServer' | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | sub getName { 'NameServer' } | ||
| 35 | |||
| 36 | =head2 setAttribute | ||
| 37 | |||
| 38 | Add check constraint to attributes. Only NameServer and IPAddress attributes can exists. | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | sub setAttribute | ||
| 43 | { | ||
| 44 | my ( $this, $key, $value ) = @_; | ||
| 45 | { nameserver => 1, ipaddress => 1, newnameserver => 1 }->{ lc ( $key ) } || throw Net::RRP::Exception::InvalidAttributeName; | ||
| 46 | $this->SUPER::setAttribute ( $key => $value ); | ||
| 47 | } | ||
| 48 | |||
| 49 | =head2 getPrimaryAttributeValue | ||
| 50 | |||
| 51 | return a "primary" attribute value | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | sub getPrimaryAttributeValue | ||
| 56 | { | ||
| 57 | my $this = shift; | ||
| 58 | $this->getAttribute ( $this->getName ); | ||
| 59 | } | ||
| 60 | |||
| 61 | 1; | ||
| 62 | |||
| 63 | =head1 AUTHOR AND COPYRIGHT | ||
| 64 | |||
| 65 | Net::RRP::Entity::NameServer (C) Michael Kulakov, Zenon N.S.P. 2000 | ||
| 66 | 125124, 19, 1-st Jamskogo polja st, | ||
| 67 | Moscow, Russian Federation | ||
| 68 | |||
| 69 | mkul@cpan.org | ||
| 70 | |||
| 71 | All rights reserved. | ||
| 72 | |||
| 73 | You may distribute this package under the terms of either the GNU | ||
| 74 | General Public License or the Artistic License, as specified in the | ||
| 75 | Perl README file. | ||
| 76 | |||
| 77 | =head1 SEE ALSO | ||
| 78 | |||
| 79 | L<Net::RRP::Entity(3)>, L<Net::RRP::Codec(3)>, RFC 2832, L<Net::RRP::Exception::InvalidAttributeName(3)> | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | __END__ |