NAME
PJob::Server --- Simple POE Job Server
VERSION
This document describes version 0.41 of PJob::Server
SYNOPSIS
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();
DESCRIPTION
PJob::Server is a simple POE Job Server module, it provides you some api to write a job server very quickly.
- new
-
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
-
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
-
Add interactive programs. Use Conduit => 'pty' in POE::Wheel::Run to convince the programs that they are interacting with terminals.
- job_dispatch
-
$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
-
Run the server, no arguments needed.
- quit/usage
-
Use 'quit' to disconnect with the server. Use 'usage' to get avaiable commands
SEE ALSO
PJob::Client,POE::Component::Server::TCP,POE::Wheel::Run,Any::Moose
AUTHOR
woosley.xu<woosley.xu@gmail.com>
COPYRIGHT & LICENSE
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.