Snippets

Brian Medley Weather from the command line

Created by Brian Medley last modified
use Mojo::Base -strict;

use Mojo::UserAgent;
use Mojo::URL;

my $ua = Mojo::UserAgent->new;

my $url = Mojo::URL->new('http://api.openweathermap.org/data/2.5/weather');

$url->query({q => '12345' });

say $ua->get($url)->res->json->{main}{temp};

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.