The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Agent::TCLI::Package::UnixBase - Base object for Agent::TCLI::Package objects accessing other Unix commands.

VERSION

This document describes Agent::TCLI::Package::UnixBase version 0.0.1

SYNOPSIS

DESCRIPTION

Base object for Packages needing to run other Unix programs. It provides methods to asnychronously call Unix programs using POW::Wheel::Run and sets up simple event handlers to accept the output and/or errors returned.

Typically, one may want their package subclass to replace the RunStdOut method with one that does more processing of the response.

INTERFACE

ATTRIBUTES

The following attributes are accessible through standard accessor/mutator methods unless otherwise noted

#=head3 name # #The name of the command. This is the word that is used to call the command. #set_name will only accept SCALAR type values. # #=cut #my @name :Field # :All('name'); # #=head3 commands # #An array of the command objects in this package. # #=cut #my @commands :Field # :Arg('commands') # :Get('commands') # :Type('HASH'); # #=head3 parameters # #A hash of the parameters used in this package. Often parameters are shared accross individual commands, so they are defined here. #parameters should only contain hash values. # #=cut #my @parameters :Field # :Type('HASH') # :Arg('parameters') # :Get('parameters'); # #my @session :Field # :Arg('session') # :Weak; ## :Type('POE::Session'); # #=head3 opt # #An internal object for holding optional parameters. Defaults to Getopt::Lucid to process parameters #opt will only accept Getopt::Lucid types. # #=cut #my @opt :Field # :All('opt'); ## :Type('Getopt::Lucid'); # #=head3 opt_args # #An array of the args passed in with a command for processing by Getopt::Lucid #opt_args will only accept ARRAY type values. # #=cut #my @opt_args :Field # :All('opt_args') # :Type('ARRAY'); # #=head3 controls # #A hash of hashes keyed on control for storing stuff. # #=cut #my @controls :Field;

#=head3 requests # #A hash collection of requests that are in progress # #=cut #my @requests :Field # :Type('HASH') # :Arg('name' => 'requests', 'default' => { } ) # :Acc('requests');

# Standard class utils are inherited

METHODS

Most of these methods are for internal use within the TCLI system and may be of interest only to developers trying to enhance TCLI.

start

This POE event handler is called when POE starts up a Package. The _start method is :Cumulative within OIO. Ideally, most command packages could use this Base _start method without implementing their own. However there seems to be a race condition between the POE initialization and the OIO object initialization. Until this is debugged one will probably have to have this _start method in every package.

AUTHOR

Eric Hacker <hacker at cpan.org>

BUGS

SHOULDS and MUSTS are currently not enforced.

Test scripts not thorough enough.

Probably many others.

LICENSE

Copyright (c) 2007, Alcatel Lucent, All rights resevred.

This package is free software; you may redistribute it and/or modify it under the same terms as Perl itself.