NAME
Agent::TCLI::Package::UnixBase - Base class for Agent::TCLI::Package objects accessing other Unix commands.
SYNOPSIS
use Object::InsideOut qw(Agent::TCLI::Package::UnixBase);
DESCRIPTION
Base class for Packages needing to run other Unix programs. It provides methods to asnychronously call Unix programs using POW::Wheel::Run through 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.
INTERFACE
ATTRIBUTES
The following attributes are accessible through standard accessor/mutator methods unless otherwise noted.
- child
-
This holds the POE::Component::Child session to use for running command line requests. A package will typically use this attribute in a chain to acceess POE::Component::Child methods. For instance, to run a command one uses:
my $wheel = $self->child->run('who');
See Agent::TCLI::Package::Base for other attributes applicable to Packages.
METHODS
These simple methods may be used as is, or subclasses may use them as starting point.
- RunWheelStart
-
This initializes the POE::Component::Child session. It may be called from a Package's _start routine or the contents may be copied for further modification.
- stdout
-
This POE event handler is the default way stdout lines are returned from the child command being run.
- stderr
-
This POE event handler is the default way stderr lines are returned from the child command being run.
- error
-
This POE event handler is the default way errors are returned from the child command being run.
- done
-
This POE event handler is the default way a child indicates that it is done.
INHERITED METHODS
This module is an Object::InsideOut object that inherits from Agent::TCLI::Package::Base. It inherits methods from both. Please refer to their documentation for more details.
AUTHOR
Eric Hacker <hacker at cpan.org>
BUGS
SHOULDS and MUSTS are currently not enforced.
Test scripts not thorough enough.
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.