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