diff options
author | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-05 05:15:06 +0000 |
---|---|---|
committer | Andrew Gaffney <agaffney@gentoo.org> | 2008-01-05 05:15:06 +0000 |
commit | dbc8b62bc7b74495cee4f2ab9bf29c04ab78c165 (patch) | |
tree | 3de3f57563c430909989788e4c67214ba27ebfe8 | |
parent | don't need SERVER_STDIN and SERVER_STDOUT here (diff) | |
download | scire-dbc8b62bc7b74495cee4f2ab9bf29c04ab78c165.tar.gz scire-dbc8b62bc7b74495cee4f2ab9bf29c04ab78c165.tar.bz2 scire-dbc8b62bc7b74495cee4f2ab9bf29c04ab78c165.zip |
move SERVER_STDIN and SERVER_STDOUT inside the class hash
svn path=/branches/new-fu/; revision=326
-rw-r--r-- | client/Scire.pm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/client/Scire.pm b/client/Scire.pm index 5530ff3..dca8da4 100644 --- a/client/Scire.pm +++ b/client/Scire.pm @@ -37,8 +37,6 @@ package Scire::Communicator; use IPC::Open2; -my ($SERVER_STDIN, $SERVER_STDOUT); - sub new { my $proto = shift; my $class = ref($proto) || $proto; @@ -46,8 +44,8 @@ sub new { port => 22, user => scire, server_script => "/usr/bin/scireserver.pl", -# SERVER_STDOUT => undef, -# SERVER_STDIN => undef, + SERVER_STDOUT => undef, + SERVER_STDIN => undef, @_ }; bless ($self, $class); @@ -69,12 +67,13 @@ sub send_command { $tosend .= " \"${arg}\""; } } -# debug("Sending: ${tosend}"); - print SERVER_STDIN "${tosend}\n"; + $tosend .= "\n"; + + my ($tmpin, $tmpout) = ($self->{SERVER_STDIN}, $self->{SERVER_STDOUT}); + print $tmpin $tosend; #FIXME WE NEED A TIMEOUT HERE OF SOME SORT!! #if the server doesn't give you a newline this just hangs! - my $response = <SERVER_STDOUT>; -# debug("Got response: ${response}"); + my $response = <$tmpout>; return $self->parse_response($response); } @@ -94,7 +93,7 @@ sub create_connection { # doesn't fail in the main process. When it fails, it outputs an error # to STDERR: # open2: exec of ../server/scireserver.pl failed at ./scireclient.pl line 116 - $self->{connection_pid} = open2(*SERVER_STDOUT, *SERVER_STDIN, $self->{connection_command}); + $self->{connection_pid} = open2($self->{SERVER_STDOUT}, $self->{SERVER_STDIN}, $self->{connection_command}); } sub build_connection_command { @@ -113,8 +112,6 @@ sub build_connection_command { # Overwrite $connection_command in the case of a dev environment for now $connection_command = "../server/scireserver.pl"; } - -# return $connection_command; $self->{connection_command} = $connection_command; } |