NAME
Clio::Process - Process wrapper
VERSION
version 0.02
SYNOPSIS
my $process = Clio::Process->new(
manager => $process_manager,
id => $uuid,
command => $command,
);
DESCRIPTION
All processes are managed by the Clio::ProcessManager. Process runs the $command
and writes to the connected clients the command output.
Can be wrapped with InputFilter
s and OutputFilter
s defined in <Command> block.
Consumes the Clio::Role::HasManager.
ATTRIBUTES
id
Process ID.
command
Command used by the process.
METHODS
start
$process->start;
Starts the "command" and passes the command output to the connected clients.
On any error object will stop the command.
stop
$process->stop;
Disconnects the connected clients and stops the command.
Invoked by Clio::ProcessManager.
write
$process->write( $line );
Writes $line
to the STDIN
of the command.
Can be altered by the InputFilter
s.
add_client
$process->add_client( $client );
Connects $client
to the process - from now on the output of the command will be written to $client
.
remove_client
$process->remove_client( $client->id );
Disconnects the $client
from the process.
clients_count
my $connected_clients = $process->clients_count();
Returns the number of connected clients.
is_idle
if ( $process->is_idle ) {
$process->stop;
}
Returns true if there are no clients connected, false otherwise.
AUTHOR
Alex J. G. Burzyński <ajgb@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Alex J. G. Burzyński <ajgb@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.