PJob::Server --- Simple POE Job Server
This document describes version 0.41 of PJob::Server
use PJob::Server; my $server = PJob::Server->new(port => '10086'); $server->logfile('./.logfile'); $server->log_commands(1); $server->add({ls => 'ls ~/', run => 'perl ~/test.pl'},'ls'); $server->run();
PJob::Server is a simple POE Job Server module, it provides you some api to write a job server very quickly.
Create a PJob::Server object. The available arguments are:
port : port to listen. 32800 by default jobs : available programs logfile : log file name log_commands : log the command runed by the client allowed_hosts : hosts' ip that are allowed to run job on this server max_connections : default is set to -1, means no limit
Add some programs, it receive both hashref and scalar. The key of the hashref is alias of the program. when scalar, the alias and the program have the same value.
Add interactive programs. Use Conduit => 'pty' in POE::Wheel::Run to convince the programs that they are interacting with terminals.
$ser->job_dispatch('127.0.0.1' => [qw/ls ps/,{cat => 'cat file'}], '*' => ['pwd']);
Dispatch available job to clients, receive client ip and its job table. * means common jobs which can be dispatched to all clients. Job table should be a arrayref. Jobs must be defined by $self->add except the situation that the element is a hashref, at this time, $self->add is called to add new job.
Any hosts dispatched with job_dispatch is considered to be an allowed host.
Run the server, no arguments needed.
Use 'quit' to disconnect with the server. Use 'usage' to get avaiable commands
PJob::Client,POE::Component::Server::TCP,POE::Wheel::Run,Any::Moose
woosley.xu<woosley.xu@gmail.com>
This software is copyright (c) 2009 by woosley.xu.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install PJob::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PJob::Client
CPAN shell
perl -MCPAN -e shell install PJob::Client
For more information on module installation, please visit the detailed CPAN module installation guide.