| 1 | package Net::RRP::Request::Renew; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Net::RRP::Request; | ||
| 5 | use Net::RRP::Exception::InvalidCommandOption; | ||
| 6 | use Net::RRP::Exception::InvalidEntityValue; | ||
| 7 | |||
| 8 | @Net::RRP::Request::Renew::ISA = qw(Net::RRP::Request); | ||
| 9 | $Net::RRP::Request::Renew::VERSION = '0.1'; | ||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | Net::RRP::Request::Renew - rrp renew request representation. | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | use Net::RRP::Request::Renew; | ||
| 18 | my $renewRequest = new Net::RRP::Request::Renew | ||
| 19 | ( entity => new Net::RRP::Entity::Domain ( DomainName => 'domain.ru' ) | ||
| 20 | options => { Period => 10, CurrentExpirationYear => 2000 } ); | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This is a rrp renew request representation class. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | =head2 getName | ||
| 29 | |||
| 30 | return a 'Renew' | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | sub getName { 'Renew' }; | ||
| 35 | |||
| 36 | =head2 setEntity | ||
| 37 | |||
| 38 | throw Net::RRP::Exception::InvalidEntityValue unless entity is Net::RRP::Entity::Domain | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | sub setEntity | ||
| 43 | { | ||
| 44 | my ( $this, $entity ) = @_; | ||
| 45 | my $ref = ref ( $entity ) || throw Net::RRP::Exception::InvalidEntityValue (); | ||
| 46 | $ref eq 'Net::RRP::Entity::Domain' || throw throw Net::RRP::Exception::InvalidEntityValue (); | ||
| 47 | $this->SUPER::setEntity ( $entity ); | ||
| 48 | } | ||
| 49 | |||
| 50 | =head2 setOption | ||
| 51 | |||
| 52 | Pass only Period && CurrentExpirationYear option. Throw Net::RRP::Exception::InvalidCommandOption at other case. | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | sub setOption | ||
| 57 | { | ||
| 58 | my ( $this, $key, $value ) = @_; | ||
| 59 | { period => 1, currentexpirationyear => 1 }->{ lc ( $key ) } || throw Net::RRP::Exception::InvalidCommandOption (); | ||
| 60 | $this->SUPER::setOption ( $key => $value ); | ||
| 61 | } | ||
| 62 | |||
| 63 | =head1 AUTHOR AND COPYRIGHT | ||
| 64 | |||
| 65 | Net::RRP::Request::Renew (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::Request(3)>, L<Net::RRP::Codec(3)>, L<Net::RRP::Entity::Domain(3)>, | ||
| 80 | L<Net::RRP::Entity::NameServer(3)>, RFC 2832, | ||
| 81 | L<Net::RRP::Exception::InvalidCommandOption(3)>, | ||
| 82 | L<Net::RRP::Exception::InvalidEntityValue(3)> | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | 1; | ||
| 87 | |||
| 88 | __END__ |