Subject: | Bug in GPSD3 Rel 3.6 Ver 0.18 |
Date: | Fri, 1 Mar 2013 23:23:19 -0700 |
To: | <bug-Net-GPSD3 [...] rt.cpan.org> |
From: | "Dennis Nendza" <dnendza [...] cox.net> |
This bug appears to be unreported though previously discovered by Attila
Brajer March 14, 2012 (
http://comments.gmane.org/gmane.comp.hardware.gps.gpsd.user/5332 )
Using GPSD3 Rel 3.6 Ver 0.18 as obtained by apt-get
Poll failed to return results under Perl 5 (v5.14.2) installed on a
Raspberry Pi running Debian Wheezy_Raspbian kernel 3.2.27+ .
Program for test:
gpstest.pl------------------------------------------------------------
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<HTML>";
print "<HEAD>";
print "<TITLE>Perl cgi Test</TITLE>";
print "</HEAD>";
print "<BODY>";
print "<H1>Test GPSD Polling</H1>";
use Net::GPSD3;
use Data::Dumper;
my $host=shift || undef;
my $port=shift || undef;
my $gpsd=Net::GPSD3->new(host=>$host, port=>$port); #default host port
as undef
my $poll=$gpsd->poll;
printf "Net::GPSD3: %s\n", $poll->parent->VERSION;
printf "GPSD Release: %s\n", $poll->parent->cache->VERSION->release;
printf "Protocol: %s\n", $poll->parent->cache->VERSION->protocol;
printf "Sats Reported: %s\n", $poll->sky->reported;
printf "Sats Used: %s\n", $poll->sky->used;
printf "Timestamp: %s\n", $poll->tpv->timestamp;
printf "Latitude: %s\n", $poll->tpv->lat;
printf "Longitude: %s\n", $poll->tpv->lon;
printf "Altitude: %s\n", $poll->tpv->alt;
print "</BODY>";
print "</HTML>";
end test
program--------------------------------------------------------------------
Results: (via
browser)---------------------------------------------------------------
Test GPSD Polling
Net::GPSD3: 0.18
GPSD Release: 3.6
Protocol: 3.7
end
results--------------------------------------------------------------------------
Same test via command line raised this error: Can't call method "reported"
on an undefined value at gpstest.pl line 23 <GEN0> line 3.
Fix proposed by Attila applied to GPSD3.pm within sub poll{} ... that was
applied for subsequent test.
sub poll {
my $self=shift;
$self->socket->send(qq(?WATCH={"enable":true};\n));
# NEW LINE ADDED
$self->socket->send(qq(?DEVICES;\n)) unless $self->cache->DEVICES;
$self->socket->send(qq(?POLL;\n));
my $object;
Test output following Attila's
fix.-----------------------------------------------------
Test GPSD Polling
Net::GPSD3: 0.18
GPSD Release: 3.6
Protocol: 3.7
Sats Reported: 11
Sats Used: 8
Timestamp: 2013-03-02T05:48:09.000Z
Latitude: 32.223115559
Longitude: -110.902183894
Altitude: 772.749
end of test
output---------------------------------------------------------------------
Thanks for a very useful package.
Dennis Nendza
dnendza@cox.net