line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NDFD::Weather::Report;
|
2
|
1
|
|
|
1
|
|
21177
|
use 5.010000;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
32
|
|
3
|
1
|
|
|
1
|
|
352
|
use SOAP::Lite;# + trace => 'debug';
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use XML::Simple;
|
5
|
|
|
|
|
|
|
use strict;
|
6
|
|
|
|
|
|
|
use warnings;
|
7
|
|
|
|
|
|
|
use version;
|
8
|
|
|
|
|
|
|
our $VERSION=1.00;
|
9
|
|
|
|
|
|
|
require Exporter;
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter);
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export
|
13
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead.
|
14
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants.
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# This allows declaration use NDFD::Weather::Report ':all';
|
17
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
18
|
|
|
|
|
|
|
# will save memory.
|
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw(
|
20
|
|
|
|
|
|
|
NDFDgen LatLonListCityNames GetCurrentWeather
|
21
|
|
|
|
|
|
|
) ] );
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT = qw(
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
);
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new {
|
30
|
|
|
|
|
|
|
my $class = shift;
|
31
|
|
|
|
|
|
|
my %params=@_;
|
32
|
|
|
|
|
|
|
my $self ={
|
33
|
|
|
|
|
|
|
%params,
|
34
|
|
|
|
|
|
|
};
|
35
|
|
|
|
|
|
|
return bless $self, $class;
|
36
|
|
|
|
|
|
|
}
|
37
|
|
|
|
|
|
|
sub _request{
|
38
|
|
|
|
|
|
|
my $class=shift;
|
39
|
|
|
|
|
|
|
my ($self)=shift;
|
40
|
|
|
|
|
|
|
$$self{'uri'} = ($$self{'uri'}) ? $$self{'uri'} :
|
41
|
|
|
|
|
|
|
'http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl',
|
42
|
|
|
|
|
|
|
$$self{'proxy'} = ($$self{'proxy'}) ? $$self{'proxy'} :
|
43
|
|
|
|
|
|
|
'http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php',
|
44
|
|
|
|
|
|
|
$$self{'EndPoint_url'} = ($$self{'EndPoint_url'}) ? $$self{'EndPoint_url'} :
|
45
|
|
|
|
|
|
|
'http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl',
|
46
|
|
|
|
|
|
|
my $soap_request = SOAP::Lite
|
47
|
|
|
|
|
|
|
-> uri($$self{'uri'})
|
48
|
|
|
|
|
|
|
->on_action(sub{join '#',@_ })
|
49
|
|
|
|
|
|
|
-> proxy($$self{'proxy'}
|
50
|
|
|
|
|
|
|
);
|
51
|
|
|
|
|
|
|
$soap_request->ns($$self{'EndPoint_url'}, 'ndf');
|
52
|
|
|
|
|
|
|
$soap_request->envprefix('soapenv');
|
53
|
|
|
|
|
|
|
$soap_request->readable(1);
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
sub Parse_XML_Data_decode{
|
56
|
|
|
|
|
|
|
my $class=shift;
|
57
|
|
|
|
|
|
|
my ($xml)=shift;
|
58
|
|
|
|
|
|
|
if (SOAP::Deserializer->is_xml($xml)==1){
|
59
|
|
|
|
|
|
|
return eval{
|
60
|
|
|
|
|
|
|
SOAP::Deserializer->decode($xml);
|
61
|
|
|
|
|
|
|
};
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
####error message marker no. 1 ###
|
65
|
|
|
|
|
|
|
print "xml_Data_parse_error","Xml parsing error: $@" if $@;
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
sub Parse_XML_deserialize{
|
68
|
|
|
|
|
|
|
my $class=shift;
|
69
|
|
|
|
|
|
|
my ($xml)=shift;
|
70
|
|
|
|
|
|
|
if (SOAP::Deserializer->is_xml($xml)==1){
|
71
|
|
|
|
|
|
|
return eval{
|
72
|
|
|
|
|
|
|
SOAP::Deserializer->deserialize($xml);
|
73
|
|
|
|
|
|
|
};
|
74
|
|
|
|
|
|
|
}
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
####error message marker no. 2 ###
|
77
|
|
|
|
|
|
|
print "xml_Data_parse_error","Xml parsing error: $@" if $@;
|
78
|
|
|
|
|
|
|
}
|
79
|
|
|
|
|
|
|
sub Parse_XML_Data{
|
80
|
|
|
|
|
|
|
my $class=shift;
|
81
|
|
|
|
|
|
|
my ($xml)=shift;
|
82
|
|
|
|
|
|
|
return eval{
|
83
|
|
|
|
|
|
|
XMLin($xml,ForceArray => 1,NormaliseSpace=>2,SuppressEmpty=>undef)
|
84
|
|
|
|
|
|
|
};
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
####error message marker no. 3 ###
|
87
|
|
|
|
|
|
|
print "xml_Data_parse_error","Xml parsing error: $@" if $@;
|
88
|
|
|
|
|
|
|
}
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
package NDFD::Weather::Processer;
|
92
|
|
|
|
|
|
|
use NDFD::Weather::GenerateXML;
|
93
|
|
|
|
|
|
|
use NDFD::Weather::RequestProcess;
|
94
|
|
|
|
|
|
|
our @ISA = qw(NDFD::Weather::Report);
|
95
|
|
|
|
|
|
|
sub CornerPoints{
|
96
|
|
|
|
|
|
|
my $Process_Return1=
|
97
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
98
|
|
|
|
|
|
|
->_CP(shift)
|
99
|
|
|
|
|
|
|
;
|
100
|
|
|
|
|
|
|
if(!$Process_Return1->valueof('//CornerPointsResponse/listLatLonOut/')){
|
101
|
|
|
|
|
|
|
if(!$Process_Return1->valueof('//ExceptionText')){
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return1->valueof('//faultstring');
|
104
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return1->valueof('//detail');
|
105
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
106
|
|
|
|
|
|
|
}else{
|
107
|
|
|
|
|
|
|
return
|
108
|
|
|
|
|
|
|
$Process_Return1
|
109
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
110
|
|
|
|
|
|
|
}
|
111
|
|
|
|
|
|
|
}
|
112
|
|
|
|
|
|
|
return $Process_Return1->valueof('//CornerPointsResponse/listLatLonOut/');
|
113
|
|
|
|
|
|
|
}
|
114
|
|
|
|
|
|
|
sub LatLonListCityNames{
|
115
|
|
|
|
|
|
|
my $Process_Return2=
|
116
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
117
|
|
|
|
|
|
|
->_LLLCN(shift)
|
118
|
|
|
|
|
|
|
;
|
119
|
|
|
|
|
|
|
if(!$Process_Return2->valueof('//LatLonListCityNamesResponse/listLatLonOut/')){
|
120
|
|
|
|
|
|
|
if(!$Process_Return2->valueof('//ExceptionText')){
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return2->valueof('//faultstring');
|
123
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return2->valueof('//detail');
|
124
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
125
|
|
|
|
|
|
|
}else{
|
126
|
|
|
|
|
|
|
return
|
127
|
|
|
|
|
|
|
$Process_Return2
|
128
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
129
|
|
|
|
|
|
|
}
|
130
|
|
|
|
|
|
|
}
|
131
|
|
|
|
|
|
|
return $Process_Return2->valueof('//LatLonListCityNamesResponse/listLatLonOut/');
|
132
|
|
|
|
|
|
|
}
|
133
|
|
|
|
|
|
|
sub LatLonListZipCode{
|
134
|
|
|
|
|
|
|
my $Process_Return3=
|
135
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
136
|
|
|
|
|
|
|
->_LLLZC(shift)
|
137
|
|
|
|
|
|
|
;
|
138
|
|
|
|
|
|
|
if(!$Process_Return3->valueof('//LatLonListZipCodeResponse/listLatLonOut/')){
|
139
|
|
|
|
|
|
|
if(!$Process_Return3->valueof('//ExceptionText')){
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return3->valueof('//faultstring');
|
142
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return3->valueof('//detail');
|
143
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
144
|
|
|
|
|
|
|
}else{
|
145
|
|
|
|
|
|
|
return
|
146
|
|
|
|
|
|
|
$Process_Return3
|
147
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
148
|
|
|
|
|
|
|
}
|
149
|
|
|
|
|
|
|
}
|
150
|
|
|
|
|
|
|
return $Process_Return3->valueof('//LatLonListZipCodeResponse/listLatLonOut/');
|
151
|
|
|
|
|
|
|
}
|
152
|
|
|
|
|
|
|
sub NDFDgenByDay{
|
153
|
|
|
|
|
|
|
my $Process_Return4=
|
154
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
155
|
|
|
|
|
|
|
->_NDFDGBD(shift);
|
156
|
|
|
|
|
|
|
if(!$Process_Return4->valueof('//NDFDgenByDayResponse/dwmlByDayOut')){
|
157
|
|
|
|
|
|
|
if(!$Process_Return4->valueof('//ExceptionText')){
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return4->valueof('//faultstring');
|
160
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return4->valueof('//detail');
|
161
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
162
|
|
|
|
|
|
|
}else{
|
163
|
|
|
|
|
|
|
return
|
164
|
|
|
|
|
|
|
$Process_Return4
|
165
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
166
|
|
|
|
|
|
|
}
|
167
|
|
|
|
|
|
|
}
|
168
|
|
|
|
|
|
|
return $Process_Return4->valueof('//NDFDgenByDayResponse/dwmlByDayOut');
|
169
|
|
|
|
|
|
|
}
|
170
|
|
|
|
|
|
|
sub NDFDgenByDayLatLonList{
|
171
|
|
|
|
|
|
|
my $Process_Return5=
|
172
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
173
|
|
|
|
|
|
|
->_NDFDGBDLLL(shift)
|
174
|
|
|
|
|
|
|
;
|
175
|
|
|
|
|
|
|
if(!$Process_Return5->valueof('//NDFDgenByDayLatLonListResponse/dwmlByDayOut')){
|
176
|
|
|
|
|
|
|
if(!$Process_Return5->valueof('//ExceptionText')){
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return5->valueof('//faultstring');
|
179
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return5->valueof('//detail');
|
180
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
181
|
|
|
|
|
|
|
}else{
|
182
|
|
|
|
|
|
|
return
|
183
|
|
|
|
|
|
|
$Process_Return5
|
184
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
185
|
|
|
|
|
|
|
}
|
186
|
|
|
|
|
|
|
}
|
187
|
|
|
|
|
|
|
return $Process_Return5->valueof('//NDFDgenByDayLatLonListResponse/dwmlByDayOut');
|
188
|
|
|
|
|
|
|
}
|
189
|
|
|
|
|
|
|
sub GmlLatLonList{
|
190
|
|
|
|
|
|
|
my $Process_Return6 =
|
191
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
192
|
|
|
|
|
|
|
->_GLLL(shift)
|
193
|
|
|
|
|
|
|
;
|
194
|
|
|
|
|
|
|
if(!$Process_Return6->valueof('//GmlLatLonListResponse/dwGmlOut')){
|
195
|
|
|
|
|
|
|
if(!$Process_Return6->valueof('//ExceptionText')){
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return6->valueof('//faultstring');
|
198
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return6->valueof('//detail');
|
199
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
200
|
|
|
|
|
|
|
}else{
|
201
|
|
|
|
|
|
|
return
|
202
|
|
|
|
|
|
|
$Process_Return6
|
203
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
204
|
|
|
|
|
|
|
}
|
205
|
|
|
|
|
|
|
}
|
206
|
|
|
|
|
|
|
#else{return $Process_Return6->valueof('//GmlLatLonListResponse/dwGmlOut')};
|
207
|
|
|
|
|
|
|
return $Process_Return6->valueof('//GmlLatLonListResponse/dwGmlOut');
|
208
|
|
|
|
|
|
|
}
|
209
|
|
|
|
|
|
|
sub NDFDgen{
|
210
|
|
|
|
|
|
|
my $Process_Return7 =
|
211
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
212
|
|
|
|
|
|
|
->_NDFDG(shift)
|
213
|
|
|
|
|
|
|
;
|
214
|
|
|
|
|
|
|
if(!$Process_Return7->valueof('//NDFDgenResponse/dwmlOut')){
|
215
|
|
|
|
|
|
|
if(!$Process_Return7->valueof('//ExceptionText')){
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return7->valueof('//faultstring');
|
218
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return7->valueof('//detail');
|
219
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
220
|
|
|
|
|
|
|
}else{
|
221
|
|
|
|
|
|
|
return
|
222
|
|
|
|
|
|
|
$Process_Return7
|
223
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
224
|
|
|
|
|
|
|
}
|
225
|
|
|
|
|
|
|
}
|
226
|
|
|
|
|
|
|
return $Process_Return7->valueof('//NDFDgenResponse/dwmlOut');
|
227
|
|
|
|
|
|
|
}
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub GmlTimeSeries{
|
230
|
|
|
|
|
|
|
my $Process_Return8 =
|
231
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
232
|
|
|
|
|
|
|
->_GTS(shift)
|
233
|
|
|
|
|
|
|
;
|
234
|
|
|
|
|
|
|
if(!$Process_Return8->valueof('//GmlTimeSeriesResponse/dwGmlOut')){
|
235
|
|
|
|
|
|
|
#&debug($Process_Return8
|
236
|
|
|
|
|
|
|
# ->valueof('//ExceptionText'));
|
237
|
|
|
|
|
|
|
if(!$Process_Return8->valueof('//ExceptionText')){
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return8->valueof('//faultstring');
|
240
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return8->valueof('//detail');
|
241
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
242
|
|
|
|
|
|
|
}else{
|
243
|
|
|
|
|
|
|
return
|
244
|
|
|
|
|
|
|
$Process_Return8
|
245
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
246
|
|
|
|
|
|
|
}
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
}
|
249
|
|
|
|
|
|
|
return $Process_Return8->valueof('//GmlTimeSeriesResponse/dwGmlOut');
|
250
|
|
|
|
|
|
|
}
|
251
|
|
|
|
|
|
|
sub LatLonListLine{
|
252
|
|
|
|
|
|
|
my $Process_Return9 =
|
253
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
254
|
|
|
|
|
|
|
->_LLLL(shift)
|
255
|
|
|
|
|
|
|
;
|
256
|
|
|
|
|
|
|
if(!$Process_Return9->valueof('//LatLonListLineResponse/listLatLonOut')){
|
257
|
|
|
|
|
|
|
if(!$Process_Return9->valueof('//ExceptionText')){
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return9->valueof('//faultstring');
|
260
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return9->valueof('//detail');
|
261
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
262
|
|
|
|
|
|
|
}else{
|
263
|
|
|
|
|
|
|
return
|
264
|
|
|
|
|
|
|
$Process_Return9
|
265
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
266
|
|
|
|
|
|
|
}
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
}
|
269
|
|
|
|
|
|
|
return $Process_Return9->valueof('//LatLonListLineResponse/listLatLonOut');
|
270
|
|
|
|
|
|
|
}
|
271
|
|
|
|
|
|
|
sub LatLonListSquare{
|
272
|
|
|
|
|
|
|
my $Process_Return10 =
|
273
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
274
|
|
|
|
|
|
|
->_LLLS(shift)
|
275
|
|
|
|
|
|
|
;
|
276
|
|
|
|
|
|
|
if(!$Process_Return10->valueof('//LatLonListSquareResponse/listLatLonOut')){
|
277
|
|
|
|
|
|
|
if(!$Process_Return10->valueof('//ExceptionText')){
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return10->valueof('//faultstring');
|
280
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return10->valueof('//detail');
|
281
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
282
|
|
|
|
|
|
|
}else{
|
283
|
|
|
|
|
|
|
return
|
284
|
|
|
|
|
|
|
$Process_Return10
|
285
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
286
|
|
|
|
|
|
|
}
|
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
}
|
289
|
|
|
|
|
|
|
return $Process_Return10->valueof('//LatLonListSquareResponse/listLatLonOut');
|
290
|
|
|
|
|
|
|
}
|
291
|
|
|
|
|
|
|
sub LatLonListSubgrid{
|
292
|
|
|
|
|
|
|
my $Process_Return11 =
|
293
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
294
|
|
|
|
|
|
|
->_LLLSBD(shift)
|
295
|
|
|
|
|
|
|
;
|
296
|
|
|
|
|
|
|
if(!$Process_Return11->valueof('//LatLonListSubgridResponse/listLatLonOut')){
|
297
|
|
|
|
|
|
|
if(!$Process_Return11->valueof('//ExceptionText')){
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return11->valueof('//faultstring');
|
300
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return11->valueof('//detail');
|
301
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
302
|
|
|
|
|
|
|
}else{
|
303
|
|
|
|
|
|
|
return
|
304
|
|
|
|
|
|
|
$Process_Return11
|
305
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
306
|
|
|
|
|
|
|
}
|
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
}
|
309
|
|
|
|
|
|
|
return $Process_Return11->valueof('//LatLonListSubgridResponse/listLatLonOut');
|
310
|
|
|
|
|
|
|
}
|
311
|
|
|
|
|
|
|
sub NDFDgenLatLonList{
|
312
|
|
|
|
|
|
|
my $Process_Return12 =
|
313
|
|
|
|
|
|
|
NDFD::Weather::RequestProcess
|
314
|
|
|
|
|
|
|
->_NDFDLLLT(shift)
|
315
|
|
|
|
|
|
|
;
|
316
|
|
|
|
|
|
|
if(!$Process_Return12->valueof('//NDFDgenLatLonListResponse/dwmlOut')){
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
if(!$Process_Return12->valueof('//ExceptionText')){
|
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
my $error_msg0 =$Process_Return12->valueof('//faultstring');
|
321
|
|
|
|
|
|
|
my $error_msg1 =$Process_Return12->valueof('//detail');
|
322
|
|
|
|
|
|
|
return "Error :-".$error_msg0.". Details :- ".$error_msg1;
|
323
|
|
|
|
|
|
|
}else{
|
324
|
|
|
|
|
|
|
return
|
325
|
|
|
|
|
|
|
$Process_Return12
|
326
|
|
|
|
|
|
|
->valueof('//ExceptionText');
|
327
|
|
|
|
|
|
|
}
|
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
}
|
330
|
|
|
|
|
|
|
return $Process_Return12->valueof('//NDFDgenLatLonListResponse/dwmlOut');
|
331
|
|
|
|
|
|
|
}
|
332
|
|
|
|
|
|
|
sub GetCurrentWeather{
|
333
|
|
|
|
|
|
|
shift;
|
334
|
|
|
|
|
|
|
my $latitude=shift;
|
335
|
|
|
|
|
|
|
my $longitude=shift;
|
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
die "latitude or longitude vlaue is missing !!" unless defined $latitude and $longitude;
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
use LWP::Simple;
|
341
|
|
|
|
|
|
|
my $url = "http://forecast.weather.gov/MapClick.php?lat=$latitude&lon=$longitude&unit=0&lg=english&FcstType=dwml";
|
342
|
|
|
|
|
|
|
my $content = get $url;
|
343
|
|
|
|
|
|
|
die "Couldn't get $url" unless defined $content;
|
344
|
|
|
|
|
|
|
#$q->header('text/xml');
|
345
|
|
|
|
|
|
|
return $content;
|
346
|
|
|
|
|
|
|
}
|
347
|
|
|
|
|
|
|
#sub debug{
|
348
|
|
|
|
|
|
|
# my $messsage=shift;
|
349
|
|
|
|
|
|
|
# print $messsage;
|
350
|
|
|
|
|
|
|
#}
|
351
|
|
|
|
|
|
|
1;
|
352
|
|
|
|
|
|
|
__END__
|