Agent-TCLI
view release on metacpan or search on metacpan
lib/Agent/TCLI/Control.pm view on Meta::CPAN
# # remains the same between transactions unless changed by the user.
# # Context may be up to five layers deep. A single command may be
# # usable in more than one context, or even in all.
#
# # The command is sent as the first arg in @args.
#
# # Each command gets the following to execute:
# # $postback -> to send the response
# # \@args -> typically the user input in an array
# # $input -> the original user input
# # $thread -> the thread object for the user's session
# # The current context is stored in the $thread as an array but is
# # retrievable as a string as well.
#
# # Some commands merely establish context. Such as 'enable' in a Cisco
# # CLI. Though enable may require additional args. A default method/session
# # of the Agent::TCLI::Package::Base class called establish_context can handle
# # the simple case of setting context and confirming for the user.
#
# # $args[0] will always be the command word to execute, but may have
# # not been the first word entered if the command is nested deep in a
# # context. If a command needs to determine exactly how it was called
lib/Agent/TCLI/Control.pm view on Meta::CPAN
# {
# $txt .= $registered_commands[$$self]{ $context }{ $command }{'name'}.", ";
# } #end foreach command
# } #end foreach context
# }
# else
# {
# # just dump some in a context
#
# # tHIS SHOULD GRAB AN ARRAY
# my $context = $request->depth_args > 0 ? $request->args->[0] : $thread[$$self]->context;
#
# # if/eslif on size of array.
# # loop over hash1.hash2.hash3.keys getting '.'{'name'}
# # loop over wildcards too
#
# foreach my $cmd ( %{ $registered_commands[$$self]{ $context } } )
# {
# $txt .= $registered_commands[$$self]{ $context }{ $cmd }{'name'}.", ";
# }
# }
lib/Agent/TCLI/Package/UnixBase.pm view on Meta::CPAN
POE::Component::Child. This base class comes with simple
event handlers to accept the output and/or errors returned from the wheel.
Typically, one may want their subclass to replace the stdout method
with one that does more processing of the responses. One should use the
methods here as a starting point in such cases.
Commands run through these methods are run in their own processes asychonously.
Other Agent processing continues while the results of the commands are
captured and returned. Package authors need to ensure that their command
threads shut down or else they may exhaust system resources.
=head1 INTERFACE
=cut
use warnings;
use strict;
use Carp;
use Object::InsideOut qw(Agent::TCLI::Package::Base);
lib/Agent/TCLI/Transport/XMPP.pm view on Meta::CPAN
# When we recv anything from XMPP the $response will be
# an array of the XMPP Session ID and then the XML message
# In ARG1 for some reason...
sub recv_pres {
my ($kernel, $self, $jSessionID, $response) =
@_[KERNEL, OBJECT, ARG0, ARG1 ];
my $msg = $response->[1];
$self->Verbose( "\tRP\tGot no response \n") if ( !defined ($response) );
# my $thread = $self->get_thread($msg);
# $self->Verbose( "\tRP\tThread: ".$thread->id()." \n") if ( defined ($thread));
# If we get our own presence, ignore it.
my $from = $msg->GetFrom('jid');
return if ( $from eq $self->jid->GetUserID );
# TODO more presence handling
# need to put presence into thread participant state? Maybe but we
# don't get the thread with the presence.
# how would we find group participants in a groupchat?
# do we need have presence of groupchat participants for anything
return ();
}
sub GetRequestForNode {
my ($self, $node ) = @_;
# This is used to package up a simple request easily
my $input = $node->GetBody;
lib/Agent/TCLI/Transport/XMPP.pm view on Meta::CPAN
'to' => $to,
'status' => $status,
'priority' => $priority,
'type' => $type,
);
return;
} # end end_pres
=item send_message
Sends a xmpp message for a control. Takes the thread and the messaage as parameters. It will overwrite the control->send attribute text with the message parameter.
=begin code
$kernel->yield('send_message' => $control => $message )
=end code
=cut
sub send_message {
( run in 0.773 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )