Agent-TCLI

 view release on metacpan or  search on metacpan

lib/Agent/TCLI/Package/UnixBase.pm  view on Meta::CPAN

package Agent::TCLI::Package::UnixBase;
#
# $Id: UnixBase.pm 59 2007-04-30 11:24:24Z hacker $
#
=head1 NAME

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

=head1 SYNOPSIS

	use Object::InsideOut qw(Agent::TCLI::Package::UnixBase);

=head1 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.

=head1 INTERFACE

=cut

use warnings;
use strict;
use Carp;
use Object::InsideOut qw(Agent::TCLI::Package::Base);

use POE qw(Component::Child Filter::Stream);

our $VERSION = '0.030.'.sprintf "%04d", (qw($Id: UnixBase.pm 59 2007-04-30 11:24:24Z hacker $))[2];

=head2 ATTRIBUTES

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

=over

=item 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');

=cut
my @child			:Field
#					:Type('type')
					:All('child');


# Standard class utils are inherited

=back

See Agent::TCLI::Package::Base for other attributes applicable to Packages.

=head2 METHODS

These simple methods may be used as is, or subclasses may use them as
starting point.

=over

=item 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.

=cut

sub RunWheelStart {
	my $self = shift;



( run in 0.541 second using v1.01-cache-2.11-cpan-39bf76dae61 )