/usr/share/doc/libpoe-component-ikc-perl/examples/inc-server is in libpoe-component-ikc-perl 0.2302-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/usr/bin/perl -w
use strict;
sub POE::Kernel::ASSERT_DEFAULT () { 1 }
sub POE::Kernel::CATCH_EXCEPTIONS () { 1 }
sub POE::Session::ASSERT_STATES () { 1 }
use POE;
use POE::Component::IKC::Server;
POE::Component::IKC::Server->spawn(
port => 12345,
name => 'Server',
);
POE::Session->create(
inline_states => {
_start => sub {
my ( $kernel, $heap ) = @_[ KERNEL, HEAP ];
my $service_name = 'Incrementor';
$kernel->alias_set($service_name);
$heap->{num} = 0;
$kernel->post( IKC => publish => $service_name, ['inc'] );
},
inc => sub {
my ($heap) = $_[HEAP];
$heap->{num}++;
print "Someone called! New value: $heap->{num}\n";
return $heap->{num};
},
_stop => sub { print "Stopping $0\n"; },
}
);
POE::Kernel->run();
|