NAME
POEIKCdaemon - POE IKC daemon
SYNOPSIS
poeikcd start -p=54321 # or poeikcd start --port=54321
poeikcd stop -p=54321 # or poeikcd stop --port=54321
#
perl -MPOEIKCdaemon -e POEIKCdaemon::daemon 54321 >> /tmp/poeikcd_log 2>&1 &
And then
use POE::Component::IKC::ClientLite;
use Data::Dumper;
my $host = '127.0.0.1';
my $port = $ARGV[0] || 54321;
print scalar localtime,"\n";
printf "[ %s : %s ]\n", $host, $port;
my ($name) = $0 =~ /(\w+)\.\w+/;
$name .= $$;
my $ikc = create_ikc_client(
ip => $host,
port => $port,
name => $name,
);
my $ret;
# method_respond
$ikc or die sprintf "%s\n\n",$POE::Component::IKC::ClientLite::error;
$ret = $ikc->post_respond('POEIKCd/method_respond' =>
['Cwd' => 'getcwd']
);
$ikc->error and die($ikc->error);
print Dumper $ret;
# function_respond
$ikc or die sprintf "%s\n\n",$POE::Component::IKC::ClientLite::error;
$ret = $ikc->post_respond('POEIKCd/function_respond' =>
['LWP::Simple' => 'get', 'http://search.cpan.org/~suzuki/']
);
$ikc->error and die($ikc->error);
print Dumper $ret;
$ikc or die sprintf "%s\n\n",$POE::Component::IKC::ClientLite::error;
$ret = $ikc->post_respond('POEIKCd/method_respond' =>
['MyClass' => 'my_method', 'args1', 'args2', 'args3 ..' ]
);
$ikc->error and die($ikc->error);
print Dumper $ret;
# reload
$ikc or die sprintf "%s\n\n",$POE::Component::IKC::ClientLite::error;
$ret = $ikc->post_respond('POEIKCd/method_respond' =>
['POEIKCdaemon::Utility'=> 'reload', 'MyClass'=> 'my_method']
);
$ikc->error and die($ikc->error);
print Dumper $ret;
# stay , It is not reload.
$ikc or die sprintf "%s\n\n",$POE::Component::IKC::ClientLite::error;
$ret = $ikc->post_respond('POEIKCd/method_respond' =>
['POEIKCdaemon::Utility' => 'stay', 'MyClass' ]
);
$ikc->error and die($ikc->error);
print Dumper $ret;
print '* 'x20,"\n";
$ikc or die sprintf "%s\n\n",$POE::Component::IKC::ClientLite::error;
$ret = $ikc->post_respond('POEIKCd/method_respond' =>
['POEIKCdaemon::Utility' => 'stop']
);
$ikc->error and die($ikc->error);
print Dumper $ret;
DESCRIPTION
POEIKCdaemon is daemon of POE::Component::IKC
AUTHOR
Yuji Suzuki <yuji.suzuki.perl@gmail.com>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.