| 1 |
#!/usr/bin/perl |
| 2 |
## |
| 3 |
## pshd -- Perl Shell Daemon |
| 4 |
## |
| 5 |
## Listens for incoming commands via Connectors |
| 6 |
## and dispatches them to handlers by passing them |
| 7 |
## to the CommandRouter or to its Core. |
| 8 |
## |
| 9 |
## Core |
| 10 |
## The core is used both in "Perl Shell" (psh.pl) |
| 11 |
## and "Perl Shell Daemon" (pshd.pl) |
| 12 |
## |
| 13 |
## Connector |
| 14 |
## It can use various Connectors |
| 15 |
## to recieve data (LocalFile, TcpHttp, TcpRpcXml). |
| 16 |
## |
| 17 |
## Core-Shell |
| 18 |
## pshd spawns a "Core-Shell" after start. It's Terminal is working the |
| 19 |
## same way as in a "Login-Shell" of the Perl Shell (psh.pl), except it's |
| 20 |
## commands are routed directly to the core. |
| 21 |
## |
| 22 |
## psh/pshd relies on POE to by asynchronous, it won't work without it! |
| 23 |
## |
| 24 |
## You will also need some POE-Components which may not be |
| 25 |
## available on CPAN and a bunch of "standard" Perl-Modules you |
| 26 |
## can download from there. Some POE versions on CPAN seem to |
| 27 |
## be not quite up-to-date sometimes, so i tried to include all needed |
| 28 |
## Perl-Modules for linux/win32 in '../perl-libs'. |
| 29 |
## |
| 30 |
## |
| 31 |
## $Id$ |
| 32 |
## |
| 33 |
## $Log$ |
| 34 |
## |
| 35 |
## |
| 36 |
|
| 37 |
use strict; |
| 38 |
use warnings; |
| 39 |
|
| 40 |
BEGIN { |
| 41 |
sub RUNNING_IN_HELL () { $^O eq 'MSWin32' } |
| 42 |
if (RUNNING_IN_HELL()) { |
| 43 |
push @INC, '../perl-libs/lib_win32'; |
| 44 |
} else { |
| 45 |
push @INC, '../perl-libs/lib_linux'; |
| 46 |
} |
| 47 |
push @INC, '../perl-libs/lib_poe'; |
| 48 |
} |
| 49 |
|
| 50 |
use lib 'lib'; |
| 51 |
use MJAM; |
| 52 |
use POE; |
| 53 |
|
| 54 |
MJAM::Command::Core::start('cmdcore'); |
| 55 |
|
| 56 |
$poe_kernel->post('cmdcore', 'docmd', 'tell cmdfd start'); |
| 57 |
#$poe_kernel->post('cmd', 'docmd', 'tell httpd start'); |
| 58 |
$poe_kernel->post('cmdcore', 'docmd', 'tell rpcxmld start'); |
| 59 |
#$poe_kernel->post('cmd', 'docmd', 'tell dbagent start'); |
| 60 |
|
| 61 |
# start a core-shell-console |
| 62 |
$poe_kernel->post( cmdcore => docmd => 'tell console start core-shell'); |
| 63 |
|
| 64 |
$poe_kernel->run(); |