Agent-TCLI
view release on metacpan or search on metacpan
lib/Agent/TCLI/Request.pm view on Meta::CPAN
my @id :Field
:All('id');
=item args
The request's arguments as parsed into an array. Usually built by the
Agent::TCLI::Control, but may be set up externally as well.
B<args> will only accept ARRAY type values. Since B<args> is an array, it is
often best use one of the mutator methods listed below.
=cut
my @args :Field
:All('args')
:Type('ARRAY' );
=item command
An array containing the prmoinent verb for this request, followed by the
rest of the context the command was issued in reversed.
B<command> will only accept ARRAY type values. Since B<command> is an array,
it is often best use one of the mutator methods listed below.
=cut
my @command :Field
:All('command')
:Type('ARRAY' );
=item sender
The POE session making the request, so that the response can be returned
properly. It is also the Tranport used when going between agents.
=cut
my @sender :Field
:All('sender')
:Type('ARRAY' );
=item postback
The event to post the response back to. It is also the return addressee when
going between agents.
=cut
my @postback :Field
:All('postback')
:Type('ARRAY' );
=item input
The exact, unparsed input string from the user. This might be useful for
some commands, but mostly is ignored. If not provided it should be automatically
generated from the command and args if necessary.
=cut
my @input :Field
:All('input');
=item response_count
A counter that is incremented for every response to this request.
This is updated automatically through the use of the Respond method.
B<response_count> will only accept NUMERIC type values.
=cut
my @response_count :Field :All('response_count')
:Type('NUMERIC' );
=item response_verbose
A setting that determines how much of the request information
is returned with the response. If true, the entire request
will be returned. If false, only the required fields will be.
B<response_verbose> should only contain boolean values.
=cut
my @response_verbose :Field
# :Type('boolean')
:All('response_verbose');
=item Arrays
Attributes that are typed as arrays also support the following mutators for
the lazy:
B<shift_>field<> - works the same as I<shift>, returing the shifted member.
B<unshift_>field<(list)> - works the same as I<unshift>.
B<pop_>field<> - works the same as I<pop>, returing the popped member.
B<push_>field<(list)> - works the same as I<push>.
B<depth_>field<> - returns the curent size of the array.
=item Auto-Attributes
Agent::TCLI::Request has an AutoMethod routine that can create object attributes
on the fly. These all use lower case set_/get_ mutators which differentiates
them from the pre-defined attributes. Since all responses should contain the
original Request object, this is a handy way to pass stateful information
about the Request to the postback handling the response.
For example: $request->set_test('like');
If the new attribute name contains 'array', it is created as an array type
and the array mutators listed above will apply.
=back
=cut
sub _init :Init {
my ($self, $args) = @_;
# Gee, this will make it real easy to 'break' into the request object
# from outside by knowing the ID. That's OK. Nothing to hide here.
$self->set(\@id, ( defined($args->{'id'}) && $args->{'id'} )
? $args->{'id'}
: $$self ) unless ($self->id);
}
=head2 METHODS
=over
( run in 0.559 second using v1.01-cache-2.11-cpan-df04353d9ac )