blob: a3dd7d6703c79eeaefbfc0637e53458981eb6a99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use strict; use warnings; use 5.014; use LWP::Simple; use URI; use JSON; use Data::Printer; my $key=$ARGV[0]; my $base = URI->new('https://api.forecast.io/forecast'); sub URI::path_segments_push { my ($uri,@segments) = @_; $uri->path_segments($uri->path_segments,@segments); }
$base->path_segments_push( $key,"51.54,-0.37", ); $base->query_form({ units => 'si', exclude => 'minutely,flags', }); my $content = get($base); my $output = decode_json($content); p $output;
|