| Net-GPSD documentation | Contained in the Net-GPSD distribution. |
Net::GPSD::Report::http - Provides a perl interface to report position data.
use Net::GPSD::Report::http; my $obj=Net::GPSD::Report::http->new(); my $return=$obj->send(\%data);
my $obj=Net::GPSD::Report::http->new({url=>$url});
$obj->url("http://localhost/path/script.cgi");
my $url=$obj->url;
my $httpreturn=$obj->send({device=>$int,
lat=>$lat,
lon=>$lon,
dtg=>"yyyy-mm-dd 24:mm:ss.sss",
speed=>$meterspersecond,
heading=>$degrees});
Email the author and log on RT.
DavisNetworks.com supports all Perl applications including this package.
Michael R. Davis, qw/gpsd michaelrdavis com/
Copyright (c) 2006 Michael R. Davis (mrdvt92)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Net-GPSD documentation | Contained in the Net-GPSD distribution. |
package Net::GPSD::Report::http; use strict; use warnings; use LWP::UserAgent; our $VERSION="0.39";
sub new { my $this = shift; my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->initialize(@_); return $self; }
sub initialize { my $self=shift(); my $data=shift(); $data->{'url'}||='http://maps.davisnetworks.com/tracking/position_report.cgi'; foreach (keys %$data) { $self->{$_}=$data->{$_}; } }
sub url { my $self = shift(); if (@_) { $self->{'url'} = shift() } #sets value return $self->{'url'}; }
sub send { my $self=shift(); my $data=shift(); #{} my $ua=LWP::UserAgent->new(); my $res = $ua->post($self->url, $data); return $res->is_success ? $res->content : undef(); }
1;