ひまぽ日記@tndl.net
WWW::Google::WeatherJP 作った。
Google 検索で、「天気 水戸」とか検索すると、天気予報を表示してくれるあいつ。
ソースコードは、例によってGitHub。
使い方も超簡単。
モジュールのインストール
$ git clone git://github.com/eru/WWW-Google-WeatherJP.git $ cd WWW-Google-WeatherJP $ perl Makefile.PL $ make $ make test $ sudo make install
サンプル
use warnings;
use strict;
use WWW::Google::WeatherJP;
use Encode;
my $weather = WWW::Google::WeatherJP->new();
$weather->get("水戸");
if($weather->success) {
print encode('utf-8', $weather->place) . "\n";
print encode('utf-8', $weather->now) . "\n";
print encode('utf-8', $weather->today) . "\n";
print encode('utf-8', $weather->tomorrow) . "\n";
print encode('utf-8', $weather->next_tomorrow) . "\n";
} else {
print "failed\n";
}
実行結果
茨城県水戸市 曇り 12°C 風: 北 2 m/s 湿度: 88% 大体晴れ 13°C / 8°C 雨の可能性 17°C / 13°C 大体晴れ 17°C / 4°C
こんな感じ。
Tagged with: perl
If you enjoyed this article, please consider sharing it!
Categories
- main (6)
- PC (33)
- Programing (8)
- Server (17)
- Sub_note (5)
- Sub_Server (1)
- Tips (10)
- たわごと (17)
- れびゅー (3)
- 工作 (1)
Articles
@tndl
- Photo: 「忍」/「たいやき」のイラスト [pixiv] http://t.co/2YMTDEEY 1 hour ago
- Photo: 「どーんm9(๑╹◡╹๑)」/「Syroh」のイラスト [pixiv] http://t.co/cAi1RdCG 1 hour ago
- Photo: 「褐色少女」/「畳と桧」のイラスト [pixiv] http://t.co/fHiaBEiU 8 hours ago
- Photo: にゃんにゃんにゃん [2] http://t.co/HVKf3f80 10 hours ago
- Photo: 「にゃんにゃんにゃん」/「ゆこ」の漫画 [pixiv] http://t.co/Qmj7FGk8 10 hours ago
- Photo: 「イチカ先輩2」/「呉風」のイラスト [pixiv] http://t.co/AvwN98Ic 10 hours ago








