NAME

Net::RRP::Request - rrp request abstraction class

SYNOPSIS

use Net::RRP::Request;
my $request = new Net::RRP::Request;

DESCRIPTION

This is a base class for all Request::* classes.

new

The constructor. You can pass entity && options attributes to this method. Example:

my $request = new Net::RRP::Request ( entity  => new Net::RRP::Entity ( .... ),
                                      options => { key => 'value' } );
my $request1 = new Net::RRP::Request ( );

getName

Return a *real* name of this request. You must overwrite this method at child class. Example:

my $requestName = $request->getName();
print STDERR "EntityName is $requestName\n";

setEntity

Setup the rrp entity for this request. Example:

$request->setEntity ( new Net::RRP::Entity ( ... ) );

getEntity

Return a entity of this request. Example:

my $entity = $request->getEntity();

Can throw Net::RRP::Exception::MissingRequiredEntity exception

getOption

Return a request option by $optionName. Example:

print $request->getOption ( $optionName ); 
print $request->getOption ( 'ttt' ); # no '-' here

Can throw Net::RRP::Exception::MissingCommandOption() exception.

setOption

Set $optionName rrp request option to the $optionValue. Example:

$request->setOption ( $optionName =>  $optionValue );
$request->setOption ( tt => 'qq' );

getOptions

Return a hash ref to the request options. Example:

my $options = $request->gtOptions();
map { print "$_ = " . $options->{$_} } keys %$options;

isSuccessResponse

Return a true if response is successfull.

my $protocol = new Net::RRP::Protocol ( .... );
my $request  = new Net::RRP::Request::Add ( .... );
$protocol->sendRequest ( $request );
my $response = $protocol->getResponse ();
die "error" unless $request->isSuccessResponse ( $response );

AUTHOR AND COPYRIGHT

Net::RRP::Request (C) Michael Kulakov, Zenon N.S.P. 2000
                      125124, 19, 1-st Jamskogo polja st,
                      Moscow, Russian Federation

                      mkul@cpan.org

All rights reserved.

You may distribute this package under the terms of either the GNU
General Public License or the Artistic License, as specified in the
Perl README file.

SEE ALSO

Net::RRP::Entity(3), Net::RRP::Response(3), Net::RRP::Codec(3), RFC 2832, Net::RRP::Exception::MissingCommandOption(3), Net::RRP::Exception::MissingRequiredEntity(3)