Parallel-Dragons
view release on metacpan or search on metacpan
lib/Parallel/Dragons.pm view on Meta::CPAN
print $fh $$;
close $pfile;
return $self->{server_socket};
}
sub daemon_name {
my $self = shift;
my $name = $self->sockfile;
($name) = (split m{/}, $name)[-1];
return "Dragons of $name";
}
sub check_daemon {
my $self = shift;
if (my $pid = $self->_get_pid()) {
my $cnt = kill 0, $pid;
return $cnt;
lib/Parallel/Dragons.pm view on Meta::CPAN
my $socket = $self->get_listen_socket();
my $conn = $socket->accept();
local $SIG{ALRM} = sub { TRACE "Timeout in communication attempt. Killing server process\n"; exit 1; };
alarm(10);
my $input = <$conn>;
my @args = split m{\s+}, $input;
while (my $cmd = shift @args) {
$cmd = lc $cmd;
if ($daemon_commands{ $cmd } ) {
my @res = $daemon_commands{ $cmd }->(
$self, $cmd, \@args
);
TRACE "Replying to $cmd: ", @res;
( run in 1.685 second using v1.01-cache-2.11-cpan-71847e10f99 )