| 1 | package Net::RRP::Request::Del; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Net::RRP::Request; | ||
| 5 | use Net::RRP::Exception::InvalidEntityValue; | ||
| 6 | use Net::RRP::Exception::InvalidCommandOption; | ||
| 7 | |||
| 8 | @Net::RRP::Request::Del::ISA = qw(Net::RRP::Request); | ||
| 9 | $Net::RRP::Request::Del::VERSION = '0.1'; | ||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | Net::RRP::Request::Del - rrp delete request representation. | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | use Net::RRP::Request::Del; | ||
| 18 | my $deleteRequest = new Net::RRP::Request::Del | ||
| 19 | ( entity => new Net::RRP::Entity::Domain ( DomainName => [ 'domain.ru' ] ) ); | ||
| 20 | my $deleteRequest1 = new Net::RRP::Request::Del (); | ||
| 21 | $deleteRequest1->setEntity ( new Net::RRP::Entity::Domain ( DomainName => [ 'domain.ru' ] ) ); | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | This is a rrp delete request representation class. | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | =head2 getName | ||
| 30 | |||
| 31 | return a 'Del' | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | sub getName { 'Del' }; | ||
| 36 | |||
| 37 | =head2 setEntity | ||
| 38 | |||
| 39 | throw Net::RRP::Exception::InvalidEntityValue unless entity is Net::RRP::Entity::Domain or Net::RRP::Entity::NameServer | ||
| 40 | |||
| 41 | =cut | ||
| 42 | |||
| 43 | sub setEntity | ||
| 44 | { | ||
| 45 | my ( $this, $entity ) = @_; | ||
| 46 | my $ref = ref ( $entity ) || throw Net::RRP::Exception::InvalidEntityValue (); | ||
| 47 | { 'Net::RRP::Entity::Domain' => 1, | ||
| 48 | 'Net::RRP::Entity::NameServer' => 1, | ||
| 49 | 'Net::RRP::Entity::Registrar' => 1, | ||
| 50 | 'Net::RRP::Entity::Replica' => 1, | ||
| 51 | 'Net::RRP::Entity::Owner' => 1, | ||
| 52 | 'Net::RRP::Entity::Contact' => 1 }->{ $ref } || throw Net::RRP::Exception::InvalidEntityValue (); | ||
| 53 | $this->SUPER::setEntity ( $entity ); | ||
| 54 | } | ||
| 55 | |||
| 56 | =head2 setOption | ||
| 57 | |||
| 58 | Pass to parent method for Registrar and Serial options, | ||
| 59 | throw Net::RRP::Exception::InvalidCommandOption () immediate if other option | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | sub setOption | ||
| 64 | { | ||
| 65 | my ( $this, $key, $value ) = @_; | ||
| 66 | return $this->SUPER::setOption ( $key => $value ) if lc ( $key ) eq 'registrar'; | ||
| 67 | return $this->SUPER::setOption ( $key => $value ) if lc ( $key ) eq 'serial'; | ||
| 68 | throw Net::RRP::Exception::InvalidCommandOption (); | ||
| 69 | } | ||
| 70 | |||
| 71 | =head1 AUTHOR AND COPYRIGHT | ||
| 72 | |||
| 73 | Net::RRP::Request::Del (C) Michael Kulakov, Zenon N.S.P. 2000 | ||
| 74 | 125124, 19, 1-st Jamskogo polja st, | ||
| 75 | Moscow, Russian Federation | ||
| 76 | |||
| 77 | mkul@cpan.org | ||
| 78 | |||
| 79 | All rights reserved. | ||
| 80 | |||
| 81 | You may distribute this package under the terms of either the GNU | ||
| 82 | General Public License or the Artistic License, as specified in the | ||
| 83 | Perl README file. | ||
| 84 | |||
| 85 | =head1 SEE ALSO | ||
| 86 | |||
| 87 | L<Net::RRP::Request(3)>, L<Net::RRP::Codec(3)>, L<Net::RRP::Entity::Domain(3)>, | ||
| 88 | L<Net::RRP::Entity::NameServer(3)>, RFC 2832, | ||
| 89 | L<Net::RRP::Exception::InvalidEntityValue(3)>, | ||
| 90 | L<Net::RRP::Exception::InvalidCommandOption(3)>, | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | 1; | ||
| 95 | |||
| 96 | __END__ |