line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::MobileJp::Plugin::GPS; |
2
|
6
|
|
|
6
|
|
30
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
171
|
|
3
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
180
|
|
4
|
6
|
|
|
6
|
|
5643
|
use URI::Escape 'uri_escape'; |
|
6
|
|
|
|
|
15740
|
|
|
6
|
|
|
|
|
564
|
|
5
|
6
|
|
|
6
|
|
7388
|
use Params::Validate; |
|
6
|
|
|
|
|
98915
|
|
|
6
|
|
|
|
|
554
|
|
6
|
6
|
|
|
6
|
|
10178
|
use HTML::Entities; |
|
6
|
|
|
|
|
47342
|
|
|
6
|
|
|
|
|
604
|
|
7
|
6
|
|
|
6
|
|
58
|
use base qw/Exporter/; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
583
|
|
8
|
6
|
|
|
6
|
|
32
|
use Carp(); |
|
6
|
|
|
|
|
1334
|
|
|
6
|
|
|
|
|
6867
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw/gps_a gps_a_attributes gps_form_attributes gps_form/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $codes = +{ |
13
|
|
|
|
|
|
|
E => +{ |
14
|
|
|
|
|
|
|
basic => { |
15
|
|
|
|
|
|
|
# http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html |
16
|
|
|
|
|
|
|
a => sub { |
17
|
|
|
|
|
|
|
+{ href => 'device:location?url=' . uri_escape $_[0] }; |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
form => sub { |
20
|
|
|
|
|
|
|
+{ action => 'device:location?url=' . uri_escape $_[0] }; |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
gps => { |
24
|
|
|
|
|
|
|
# http://www.siisise.net/gps.html#augps |
25
|
|
|
|
|
|
|
# datum:wgs84, unit:dms |
26
|
|
|
|
|
|
|
a => sub { |
27
|
|
|
|
|
|
|
+{ |
28
|
|
|
|
|
|
|
href => ( |
29
|
|
|
|
|
|
|
'device:gpsone?url=' |
30
|
|
|
|
|
|
|
. uri_escape( $_[0] ) |
31
|
|
|
|
|
|
|
. '&ver=1&datum=0&unit=0&acry=0&number=0' |
32
|
|
|
|
|
|
|
) |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
form => sub { |
36
|
|
|
|
|
|
|
+{ |
37
|
|
|
|
|
|
|
action => 'device:gpsone', |
38
|
|
|
|
|
|
|
hidden => +{ |
39
|
|
|
|
|
|
|
url => $_[0], |
40
|
|
|
|
|
|
|
ver => 1, |
41
|
|
|
|
|
|
|
datum => 0, |
42
|
|
|
|
|
|
|
unit => 0, |
43
|
|
|
|
|
|
|
acry => 0, |
44
|
|
|
|
|
|
|
number => 0, |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
I => +{ |
51
|
|
|
|
|
|
|
gps => { |
52
|
|
|
|
|
|
|
# http://www.nttdocomo.co.jp/service/imode/make/content/gps/ |
53
|
|
|
|
|
|
|
'a' => sub { +{ href => $_[0], lcs => 'lcs' } }, |
54
|
|
|
|
|
|
|
'form' => sub { +{ action => $_[0], lcs => 'lcs' } }, |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
basic => { |
57
|
|
|
|
|
|
|
# http://www.nttdocomo.co.jp/service/imode/make/content/iarea/ |
58
|
|
|
|
|
|
|
a => sub { |
59
|
|
|
|
|
|
|
+{ |
60
|
|
|
|
|
|
|
href => ( |
61
|
|
|
|
|
|
|
'http://w1m.docomo.ne.jp/cp/iarea' |
62
|
|
|
|
|
|
|
. '?ecode=OPENAREACODE&msn=OPENAREAKEY&posinfo=1&nl=' |
63
|
|
|
|
|
|
|
. uri_escape $_[0] |
64
|
|
|
|
|
|
|
) |
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
form => sub { |
68
|
|
|
|
|
|
|
+{ |
69
|
|
|
|
|
|
|
action => "http://w1m.docomo.ne.jp/cp/iarea", |
70
|
|
|
|
|
|
|
hidden => { |
71
|
|
|
|
|
|
|
ecode => 'OPENAREACODE', |
72
|
|
|
|
|
|
|
msn => 'OPENAREAKEY', |
73
|
|
|
|
|
|
|
posinfo => 1, |
74
|
|
|
|
|
|
|
nl => $_[0], |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
}, |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
}, |
80
|
|
|
|
|
|
|
H => +{ |
81
|
|
|
|
|
|
|
basic => { |
82
|
|
|
|
|
|
|
# http://www.willcom-inc.com/ja/service/contents_service/club_air_edge/for_phone/homepage/index.html |
83
|
|
|
|
|
|
|
# DO NOT uri_escape. WILLCOM PHONES REQUIRE RAW URI. |
84
|
|
|
|
|
|
|
a => sub { |
85
|
|
|
|
|
|
|
+{ href => 'http://location.request/dummy.cgi?my=' |
86
|
|
|
|
|
|
|
. $_[0] |
87
|
|
|
|
|
|
|
. '&pos=$location' }; |
88
|
|
|
|
|
|
|
}, |
89
|
|
|
|
|
|
|
form => sub { |
90
|
|
|
|
|
|
|
Carp::croak("form type is not supported on willcom(maybe)"); |
91
|
|
|
|
|
|
|
}, |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
V => +{ |
95
|
|
|
|
|
|
|
gps => +{ |
96
|
|
|
|
|
|
|
# see HTMLç·¨ in http://creation.mb.softbank.jp/web/web_doc.html |
97
|
|
|
|
|
|
|
# DO NOT uri_escape. SOFTBANK PHONES REQUIRE RAW URI. |
98
|
|
|
|
|
|
|
a => sub { |
99
|
|
|
|
|
|
|
+{ href => 'location:auto?url=' . $_[0] } |
100
|
|
|
|
|
|
|
}, |
101
|
|
|
|
|
|
|
form => sub { |
102
|
|
|
|
|
|
|
+{ action => 'location:auto?url=' . $_[0] } |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
basic => { |
106
|
|
|
|
|
|
|
# see HTMLç·¨ in http://creation.mb.softbank.jp/web/web_doc.html |
107
|
|
|
|
|
|
|
a => sub { |
108
|
|
|
|
|
|
|
+{ href => $_[0], z => 'z' }; |
109
|
|
|
|
|
|
|
}, |
110
|
|
|
|
|
|
|
form => sub { |
111
|
|
|
|
|
|
|
+{ action => $_[0], z => 'z' }; |
112
|
|
|
|
|
|
|
}, |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
}, |
115
|
|
|
|
|
|
|
}; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub gps_a_attributes { |
118
|
9
|
|
|
9
|
0
|
71767
|
my %args = validate( |
119
|
|
|
|
|
|
|
@_, |
120
|
|
|
|
|
|
|
+{ |
121
|
|
|
|
|
|
|
callback_url => +{ regex => qr{^https?://} }, |
122
|
|
|
|
|
|
|
carrier => +{ regex => qr{^[IEVH]$} }, |
123
|
|
|
|
|
|
|
is_gps => 1, |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
); |
126
|
|
|
|
|
|
|
|
127
|
9
|
100
|
|
|
|
368
|
$codes->{$args{carrier}}->{$args{is_gps} ? 'gps' : 'basic'}->{a}->($args{callback_url}); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub gps_form_attributes { |
131
|
12
|
|
|
12
|
0
|
66471
|
my %args = validate( |
132
|
|
|
|
|
|
|
@_, |
133
|
|
|
|
|
|
|
+{ |
134
|
|
|
|
|
|
|
callback_url => { regex => qr{^https?://} }, |
135
|
|
|
|
|
|
|
carrier => { regex => qr{^[IEVH]$} }, |
136
|
|
|
|
|
|
|
is_gps => 1, |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
); |
139
|
|
|
|
|
|
|
|
140
|
12
|
100
|
|
|
|
384
|
$codes->{$args{carrier}}->{$args{is_gps} ? 'gps' : 'basic'}->{'form'}->($args{callback_url}); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub gps_a { |
144
|
2
|
|
|
2
|
0
|
46756
|
my %args = validate( |
145
|
|
|
|
|
|
|
@_, |
146
|
|
|
|
|
|
|
+{ |
147
|
|
|
|
|
|
|
callback_url => { regex => qr{^https?://} }, |
148
|
|
|
|
|
|
|
carrier => { regex => qr{^[IEVH]$} }, |
149
|
|
|
|
|
|
|
is_gps => 1, |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
); |
152
|
|
|
|
|
|
|
|
153
|
2
|
|
|
|
|
95
|
my $attributes = gps_a_attributes(%args); |
154
|
|
|
|
|
|
|
|
155
|
2
|
|
|
|
|
65
|
my $ret = ""; |
156
|
2
|
|
|
|
|
14
|
for my $name (sort { $a cmp $b } keys %$attributes) { |
|
1
|
|
|
|
|
7
|
|
157
|
3
|
|
|
|
|
33
|
$ret .= qq{ $name="} . encode_entities($attributes->{$name}) . q{"}; |
158
|
|
|
|
|
|
|
} |
159
|
2
|
|
|
|
|
60
|
""; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub gps_form { |
163
|
6
|
|
|
6
|
0
|
56611
|
my %args = validate( |
164
|
|
|
|
|
|
|
@_, |
165
|
|
|
|
|
|
|
+{ |
166
|
|
|
|
|
|
|
callback_url => { regex => qr{^https?://} }, |
167
|
|
|
|
|
|
|
carrier => { regex => qr{^[IEVH]$} }, |
168
|
|
|
|
|
|
|
is_gps => 1, |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
); |
171
|
|
|
|
|
|
|
|
172
|
6
|
|
|
|
|
174
|
my $attributes = gps_form_attributes(%args); |
173
|
|
|
|
|
|
|
|
174
|
6
|
|
|
|
|
65
|
my $hidden = delete $attributes->{hidden}; |
175
|
|
|
|
|
|
|
|
176
|
6
|
|
|
|
|
8
|
my $ret = ""; |
177
|
6
|
|
|
|
|
22
|
for my $name (sort { $a cmp $b } keys %$attributes) { |
|
2
|
|
|
|
|
7
|
|
178
|
8
|
|
|
|
|
49
|
$ret .= qq{ $name="} . encode_entities($attributes->{$name}) . q{"}; |
179
|
|
|
|
|
|
|
} |
180
|
6
|
|
|
|
|
75
|
$ret = " |
181
|
6
|
|
|
|
|
21
|
for my $name (sort { $a cmp $b } keys %$hidden) { |
|
15
|
|
|
|
|
20
|
|
182
|
10
|
|
|
|
|
23
|
$ret .= qq!\n!; |
183
|
|
|
|
|
|
|
} |
184
|
6
|
|
|
|
|
37
|
$ret; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
1; |
188
|
|
|
|
|
|
|
__END__ |