JustMu has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a Windows application that grabs GPS and Iperf data. My app accesses the GPS receiver through a serial port by way of GPS::NMEA, and it gets the Iperf data by way of `iperf -c $options`. The backquoted command works until a GPS capture has been performed, but after even a single GPS capture the backquoted Iperf command, in fact *any* backquoted command, causes my app to hang. An attempt to have the command pipe its output to a filehandle gives the same result.
  • Comment on GPS capture blows away subsequent backtick command

Replies are listed 'Best First'.
Re: GPS capture blows away subsequent backtick command
by talexb (Chancellor) on Jan 12, 2007 at 13:36 UTC

    I highly recommend using Log::Log4perl for help in diagnosing your problem.

    Once you've figured out what the problem is, we can start to assist you in a solution. Right now the problem is too vague, therefore the solution set is too large. Good luck.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: GPS capture blows away subsequent backtick command
by phaylon (Curate) on Jan 12, 2007 at 10:53 UTC
    You didn't ask a question and didn't provide source code demonstrating your problem. So how should we help you? We mostly want to, but only if you don't make it too hard for us.

    Ordinary morality is for ordinary people. -- Aleister Crowley
      A question was implied. Here's the relevant code, which I didn't post before because I doubt it'll help. I was hoping that someone had already encountered this trouble, which I suspect has something to do with Win32::SerialPort.
      # First call this sub. sub connectToGPS { my $gps; if ($winMain->rbNMEA->Checked()) { $gps = new GPS::NMEA(Port => $winMain->cbGPSPort->Text(), Baud => $winMain->cbPortBaud->Text()); } else { $gps = new GPS::Garmin(Port => $winMain->cbGPSPort->Text(), Baud => $winMain->cbPortBaud->Text()); } return $gps; } # Then pass its returned value to this sub. sub getGPSData { my $gps = shift; my %gpsHash = %{$gps}; my $port = $gpsHash{serial}; $port->purge_all(); $port->stty_kill("\cU"); my ($time, $satsUsed, $accuracy, $quality, $speed); if ($winMain->rbNMEA->Checked()) { $gps->parse(); my %gpsData = %{$gps->{NMEADATA}}; $time = $gpsData{time_utc}; $time = "---" unless $time; $satsUsed = $gpsData{num_sat_tracked}; $satsUsed = "---" unless $satsUsed; $satsUsed = 0 if $satsUsed eq "00"; $accuracy = $gpsData{data_valid}; $accuracy = "---" unless $accuracy; $quality = $gpsData{fixq012}; $quality = "---" unless $quality; $speed = $gpsData{speed_over_ground}; $speed = "---" unless $speed; $speed = "---" if $speed eq ""; } else { my ($sec, $min, $hour, $mday, $mon, $year) = $gps->get_time(); $time = "$hour:$min:$sec"; $time = "---" if $time eq "::"; } my ($latitudeSign, $latitude, $longitudeSign, $longitude) = $gps-> +get_position(); $port->close(); # Irrelevant GUI update code goes here. }
Re: GPS capture blows away subsequent backtick command
by Errto (Vicar) on Jan 13, 2007 at 00:14 UTC
    What happens if you try to run that command directly outside your Perl program? If a backtick call hangs, it seems likely that the program itself is hung or that it is waiting for some kind of input from the user.