mrhyde has asked for the wisdom of the Perl Monks concerning the following question:
I suppose there is a socket reference being missed, or something similar. What am I doing wrong?use strict; use warnings; use IO::Socket::SSL qw(debug4); my $_pid; my $connection = IO::Socket::SSL->new( PeerHost => 'local.btc-node', PeerPort => 7566, Proto=> 'tcp', Timeout => 8, SSL_verify_mode => 0x00 ) or die($!); while(<$connection>) { if(/action1/) { # do something, no problem } elsif(/tick\s+([^\d\s\t]+)/) { my $currency = $1; tick ($connection, $currency); } } sub tick { my $socket = shift; my $currency = shift; if ($_pid = fork) { waitpid($_pid, 0); } else { if (fork) { exit; } else { my $response =`tick $currency 2>&1 3>&1`; $socket->print($response . "\n"); # without this line $con +nection doesn't break on the second call exit; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::Socket::SSL + fork problem
by Anonymous Monk on Nov 20, 2014 at 17:51 UTC | |
by mrhyde (Novice) on Nov 20, 2014 at 19:22 UTC | |
by BrowserUk (Patriarch) on Nov 20, 2014 at 19:39 UTC | |
|
Re: IO::Socket::SSL + fork problem
by mrhyde (Novice) on Nov 21, 2014 at 04:50 UTC | |
|
Re: IO::Socket::SSL + fork problem
by noxxi (Pilgrim) on Nov 23, 2014 at 09:44 UTC |