line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::GPSD::Report::http; |
2
|
1
|
|
|
1
|
|
748
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
922
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
43416
|
|
|
1
|
|
|
|
|
228
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION="0.39"; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::GPSD::Report::http - Provides a perl interface to report position data. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Net::GPSD::Report::http; |
15
|
|
|
|
|
|
|
my $obj=Net::GPSD::Report::http->new(); |
16
|
|
|
|
|
|
|
my $return=$obj->send(\%data); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 new |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $obj=Net::GPSD::Report::http->new({url=>$url}); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
30
|
0
|
|
0
|
|
|
|
my $class = ref($this) || $this; |
31
|
0
|
|
|
|
|
|
my $self = {}; |
32
|
0
|
|
|
|
|
|
bless $self, $class; |
33
|
0
|
|
|
|
|
|
$self->initialize(@_); |
34
|
0
|
|
|
|
|
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 initialize |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub initialize { |
44
|
0
|
|
|
0
|
1
|
|
my $self=shift(); |
45
|
0
|
|
|
|
|
|
my $data=shift(); |
46
|
0
|
|
0
|
|
|
|
$data->{'url'}||='http://maps.davisnetworks.com/tracking/position_report.cgi'; |
47
|
0
|
|
|
|
|
|
foreach (keys %$data) { |
48
|
0
|
|
|
|
|
|
$self->{$_}=$data->{$_}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 url |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$obj->url("http://localhost/path/script.cgi"); |
55
|
|
|
|
|
|
|
my $url=$obj->url; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub url { |
60
|
0
|
|
|
0
|
1
|
|
my $self = shift(); |
61
|
0
|
0
|
|
|
|
|
if (@_) { $self->{'url'} = shift() } #sets value |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $self->{'url'}; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 send |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $httpreturn=$obj->send({device=>$int, |
68
|
|
|
|
|
|
|
lat=>$lat, |
69
|
|
|
|
|
|
|
lon=>$lon, |
70
|
|
|
|
|
|
|
dtg=>"yyyy-mm-dd 24:mm:ss.sss", |
71
|
|
|
|
|
|
|
speed=>$meterspersecond, |
72
|
|
|
|
|
|
|
heading=>$degrees}); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub send { |
77
|
0
|
|
|
0
|
1
|
|
my $self=shift(); |
78
|
0
|
|
|
|
|
|
my $data=shift(); #{} |
79
|
0
|
|
|
|
|
|
my $ua=LWP::UserAgent->new(); |
80
|
0
|
|
|
|
|
|
my $res = $ua->post($self->url, $data); |
81
|
0
|
0
|
|
|
|
|
return $res->is_success ? $res->content : undef(); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 LIMITATIONS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 BUGS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Email the author and log on RT. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SUPPPORT |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
DavisNetworks.com supports all Perl applications including this package. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 AUTHOR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Michael R. Davis, qw/gpsd michaelrdavis com/ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 LICENSE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Copyright (c) 2006 Michael R. Davis (mrdvt92) |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SEE ALSO |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |