| 1 | #!/usr/local/bin/perl | ||
| 2 | package main; | ||
| 3 | use strict; | ||
| 4 | use Weather::MOSMIX; | ||
| 5 | use JSON 'encode_json'; | ||
| 6 | use Weather::MOSMIX; | ||
| 7 | use Getopt::Long; | ||
| 8 | |||
| 9 | our $VERSION = '0.04'; | ||
| 10 | |||
| 11 | GetOptions( | ||
| 12 | 'dsn=s' => \my $dsn, | ||
| 13 | ); | ||
| 14 | |||
| 15 | $dsn ||= 'dbi:SQLite:dbname=mosmix-forecast.sqlite'; | ||
| 16 | my $w = Weather::MOSMIX->new( | ||
| 17 | dbh => { | ||
| 18 | dsn => $dsn | ||
| 19 | }, | ||
| 20 | ); | ||
| 21 | |||
| 22 | my $f = $w->locations(); | ||
| 23 | binmode STDOUT, ':encoding(UTF-8)'; | ||
| 24 | print encode_json($f); |