File size: 1,090 Bytes
158b61b |
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 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# file: RemoteProcess.pm
# Herve Saint-Amand
# Universitaet des Saarlandes
# Thu May 15 08:30:19 2008
#------------------------------------------------------------------------------
# includes
package RemoteProcess;
our @ISA = qw/Subprocess/;
use warnings;
use strict;
use IO::Socket::INET;
use Subprocess;
#------------------------------------------------------------------------------
# constructor
sub new {
my ($class, $host, $port) = @_;
my $self = new Subprocess;
$self->{host} = $host;
$self->{port} = $port;
$self->{sock} = undef;
bless $self, $class;
}
#------------------------------------------------------------------------------
# should have the same interface as Subprocess.pm
sub start {
my ($self) = @_;
$self->{sock} = new IO::Socket::INET (%{{
PeerAddr => $self->{host},
PeerPort => $self->{port},
}}) || die "Can't connect to $self->{host}:$self->{port}";
$self->{child_in} = $self->{child_out} = $self->{sock};
}
#------------------------------------------------------------------------------
1;
|