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:

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”

  1. GPS » Using gpsd in a simple perl-script on January 14th, 2008 03:07

    [...] Here’s another interesting post I read today by Location-aware mobility [...]

  2. doc on February 7th, 2009 00:34

    don’t fear CPAN…. it asks you before it installs each one, logs everything, etc. would have been an equally small subset of tools.

  3. Programing the Nokia Tablet « Brian’s Mind on June 23rd, 2009 23:33

    [...] Perl? link [...]

  4. tarball's messy! on July 1st, 2010 18:50

    really aghh.

Leave a Reply




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word