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

This has been plaguing me for awhile now. I had to switch from DeLorme to GlobalSat GPS receivers since the serial emulator would not allow external programs to access the GPS stream easily. I am using the perl distro Perl-GPS 0.16 to access the NMEA receiver. Using this small program:
#!/usr/bin/perl #perl2exe_include "bytes.pm" use GPS::NMEA; use Data::Dumper; my $gps = GPS::NMEA->new(Port => 'COM6', # or COM5: or /dev/ttyS0 Baud => 4800); while(1) { $gps->parse; # Dump internal NMEA data: $gps->nmea_data_dump; # Alternative to look at the internal NMEA data: require Data::Dumper; print Data::Dumper->new([$gps->{NMEADATA}],[])->Indent(1)->Use +qq(1)->Dump; } __END__
I have received this error:
Second Read attempted before First is done at C:/Perl/site/lib/GPS/Ser +ial.pm lin e 55
which sounds like it could be a baud problem but I have tried it with several other values and received the same error.

Replies are listed 'Best First'.
Re: Errors in GPS::Serial
by waba (Monk) on May 28, 2008 at 06:37 UTC

    From the source code, it looks like the CommPort internal lock _R_BUSY is never unlocked for some reason. Most likely, a "background" read is started, followed by another before the first one had a chance to finish (read_done), leading to this message.

    This said, I know nothing about serial port handling in Perl, in particular on Win32, so you should probably contact the GPS module author as it looks like a bug in his code.