Net::GPSD::Report::http - Provides a perl interface to report position data.


Net-GPSD documentation Contained in the Net-GPSD distribution.

Index


Code Index:

NAME

Top

Net::GPSD::Report::http - Provides a perl interface to report position data.

SYNOPSIS

Top

  use Net::GPSD::Report::http;
  my $obj=Net::GPSD::Report::http->new();
  my $return=$obj->send(\%data);

DESCRIPTION

Top

CONSTRUCTOR

Top

new

  my $obj=Net::GPSD::Report::http->new({url=>$url});

METHODS

Top

initialize

url

  $obj->url("http://localhost/path/script.cgi");
  my $url=$obj->url;

send

  my $httpreturn=$obj->send({device=>$int,
                             lat=>$lat,
                             lon=>$lon,
                             dtg=>"yyyy-mm-dd 24:mm:ss.sss",
                             speed=>$meterspersecond,
                             heading=>$degrees});

LIMITATIONS

Top

BUGS

Top

Email the author and log on RT.

SUPPPORT

Top

DavisNetworks.com supports all Perl applications including this package.

AUTHOR

Top

Michael R. Davis, qw/gpsd michaelrdavis com/

LICENSE

Top

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.

SEE ALSO

Top

LWP::UserAgent


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;