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