Using gpsd in a simple perl-script
Posted on January 14, 2008
Filed Under Maemo, N810, Tips |
I was playing around with gps-software on the N810 and decided to try how hard it would be to make a simple perl-script that uses the gpsd on OS2008. As a side note: I really don’t know perl at all, and don’t even like it - I actually hate it for some reason…
I decided to go with Charles Curleys gpsdate-script that uses gpsd to show the UTC time from the satellites. I hoped it would be a simple task, but actually I had to resolve some dependency issues. Seven to be exact.
To get this script working, I had to get additional perl modules, distributions and whatnot, but it was quite simple by searching and downloading in search.cpan.org. I probably could have used perls automatic download functionality, but even if I could, I didn’t want to fill my devices innards with endless perl-libraries. I wanted some control. I just downloaded these “packages” and used the -I/lib/dir/here switch:
- GPS-PRN
- Geo-Constants
- Geo-Ellipsoids
- Geo-Functions
- Geo-Forward
- Geo-Inverse
- Net-GPSD
One might argue that I could have gotten to the same outcome by not using Net-GPSD and it’s dependencies, but I think that by going this route there’s more functionality available for future fiddling.
I modified the original source by removing some command-line argument handling to get rid of Getopt::Std. So this is a dirty hack all around
To make it work, make sure gpsd is running (by starting maps for instance) and run the script from console:
/media/mmc2/tmp/gpsdate $ perl -I./includes gpsdate.pl
/gpsdate.pl: It is 22:31:30.00, 2008-01-14, UTC.
You can download the modified script and the dependencies here.
Comments
4 Responses to “Using gpsd in a simple perl-script”
Leave a Reply
[...] Here’s another interesting post I read today by Location-aware mobility [...]
don’t fear CPAN…. it asks you before it installs each one, logs everything, etc. would have been an equally small subset of tools.
[...] Perl? link [...]
really aghh.