in reply to Re: GPS Widget
in thread GPS Widget
sub gps { my $gps_device; while (1) { goto END if $die == 1; if ($gps_start == 1) { $gps_device = GPS::NMEA->new(Port => $gps, Baud => 4800) o +r die; my $timeout = 5; while (1){ #stops the warnings in the GPS device module local $^W = 0; print "before\n"; eval { local $SIG{ALRM} = sub {die "GPS Device has timed +out\n"}; alarm $timeout; ($ns,$lat,$ew,$lon) = $gps_device->get_position; #warn $@ if $@; alarm 0; }; die if $@ && $@ ne "GPS Device has timed out\n"; if ($@){ print "WARNING\n"; } else{ print "nope\n"; } #($ns,$lat,$ew,$lon) = $gps_device->get_position; print "after\n"; print "$die\n"; goto END if $die == 1; last if $gps_start == 0; sleep 3; } undef $gps_device; } else {sleep 4} } END: }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: GPS Widget
by BrowserUk (Patriarch) on Feb 22, 2008 at 01:53 UTC | |
|
Re^3: GPS Widget
by zentara (Cardinal) on Feb 22, 2008 at 14:21 UTC |