Group
Extension

Matches 4

Weather-MOSMIX ( C/CO/CORION/Weather-MOSMIX-0.04.tar.gz, CORION, 2024; MetaCPAN )
Weather-MOSMIX/script/dump-locations.pl ( view source; MetaCPAN )
#!perl
package main;
use strict;
use Weather::MOSMIX;
use JSON 'encode_json';
use Weather::MOSMIX;
use Getopt::Long;

our $VERSION = '0.04';

GetOptions(
    'dsn=s'   => \my $dsn,
);

$dsn ||= 'dbi:S
QLite:dbname=mosmix-forecast.sqlite';
my $w = Weather::MOSMIX->new(
    dbh => {
        dsn => $dsn
    },
);

my $f = $w->locations();
binmode STDOUT, ':encoding(UTF-8)';
print encode_json($f);
Weather-MOSMIX ( C/CO/CORION/Weather-MOSMIX-0.04.tar.gz, CORION, 2024; MetaCPAN )
Weather-MOSMIX/lib/Weather/MOSMIX/Writer.pm ( view source; MetaCPAN )
MOSMIX::Writer;
use strict;
use Moo 2;
use experimental 'signatures';
use DBI;
require POSIX;
use JSON;

=head1 NAME

Weather::MOSMIX::Writer - Write MOSMIX weather forecast data to a DBI handle

=hea
(
    is => 'lazy',
    default => \&_prepare_forecast_sth,
);

has 'json' => (
    is => 'lazy',
    default => sub {
        JSON->new()
    },
);

sub _prepare_location_sth( $self ) {
    $self->db
or_fetch(sub {
        my $rec = $records[$i++];
        return if ! $rec;
        my $f = $self->json->encode( $rec->{forecasts} );
        [$rec->{name}, $f, $expiry, $rec->{issuetime}]
    });
};

Weather-MOSMIX ( C/CO/CORION/Weather-MOSMIX-0.04.tar.gz, CORION, 2024; MetaCPAN )
Weather-MOSMIX/lib/Weather/MOSMIX.pm ( view source; MetaCPAN )
package Weather::MOSMIX;
use strict;
use Moo 2;
use experimental 'signatures';
use DBI;
use JSON;
use DBD::SQLite 1.56; # some virtual table bugfixes
use Weather::MOSMIX::Weathercodes 'mosmix_weatherc
ooX::Role::DBIConnection';

our $TIMESTAMP = '%Y-%m-%dT%H:%M:%S';

has 'json' => (
    is => 'lazy',
    default => sub {
		JSON->new()
	},
);

# Convert an array into an SQLite virtual table
# This s
tance asc, expiry desc
            limit 1
SQL
    for (@$res) {
        $_->{forecasts} = $self->json->decode($_->{forecasts})
    };
    $res->[0]
};

sub forecast_dbh( $self, %options ) {
    my $r
Weather-MOSMIX ( C/CO/CORION/Weather-MOSMIX-0.04.tar.gz, CORION, 2024; MetaCPAN )
Weather-MOSMIX/lib/Weather/WeatherGov.pm ( view source; MetaCPAN )
:WeatherGov;
use strict;
use warnings;
our $VERSION = '0.04';

use HTTP::Tiny;
use URI;
use JSON 'decode_json';

use Moo 2;
use feature 'signatures';
no warnings 'experimental::signatures';

our $base
uch we hit weather.gov
    my $loc = $self->json_request($entry);
    $self->json_request(
        $loc->{properties}->{forecastHourly},
    );

}

sub json_request( $self, $uri ) {
    my $response =
 $self->ua->request(GET => $uri, {
        accept => 'JSON-LD',
    } );
    decode_json( $response->{content} );
}

1;

=head1 SEE ALSO

L<https://www.weather.gov/documentation/services-web-api>

L<h

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.