Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Measure temperature outside in Perl

by tobyink (Abbot)
on Feb 04, 2012 at 10:31 UTC ( #951791=note: print w/replies, xml ) Need Help??

in reply to Measure temperature outside in Perl

use 5.010; use strict; use Web::Magic 0.007; my %opts = ( 'w' => 26191, # Yahoo WOEID 'u' => 'c', # Unit: 'c' or 'f' ); my ($temperature) = Web::Magic -> new(q<>, %opts) -> findnodes('//yweather:condition/@temp') -> map(sub { $_->value }); say "Temperature is $temperature";

Works for me!

Update: Yahoo WOEIDs (Where On Earth Identifier) are numeric identifiers used by Yahoo for places. Here's a tool to look up WOEIDs. The WOEID in the script above is for Lewes, East Sussex.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951791]
[holli]: put mine in :)
[holli]: instant cat fame
[virtualsue]: nice photo
[holli]: the fricking beast will only eat dry food
[holli]: nothing else, not even minced meat or fish
[Discipulus]: see you nuns and monks!
[KurtZ]: mice?

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-11-21 12:41 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (300 votes). Check out past polls.