The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Weather::MOSMIX::Read - Read MOSMIX weather forecast data

SYNOPSIS

This reads and parses the XML from the compressed .kmz file and writes it to an SQLite database:

    my $w = Weather::MOSMIX::Writer->new(
        dsn => 'dbi:SQLite:dbname=db/forecast.sqlite',
    );
    my $r = Weather::MOSMIX::Reader->new(
        writer => $w,
    );

    for my $file (@files) {
        status("Importing $file\n");
        $r->read_zip( $file );
    };

METHODS

Weather::MOSMIX::Reader->new()

ACCESSORS

twig

expiry

issuetime

writer

METHODS

->file_expiry

->open_zip

    my $fh = $reader->open_zip(
        zip_name =>
        contained_name =>

Opens the first file from a .kmz file and returns an unzipping filehandle so the data can be streamed in. If no contained_name is given, the first file will be read.

->read_zip

    $reader->read_zip( $kmzfile );

Opens the .kmz file and parses the KML data in the first contained file.

->parse_fh

    $reader->parse_fh( $xml_fh, expiry => '2020-02-15T14:00:00Z );

Parses the KML data streaming from the filehandle. The optional expiry option can be used to pass an expiry date.

REPOSITORY

The public repository of this module is https://github.com/Corion/weather-mosmix.

SUPPORT

The public support forum of this module is https://perlmonks.org/.

BUG TRACKER

Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=Weather-MOSMIX or via mail to www-Weather-MOSMIX@rt.cpan.org.

AUTHOR

Max Maischein corion@cpan.org

COPYRIGHT (c)

Copyright 2019-2020 by Max Maischein corion@cpan.org.

LICENSE

This module is released under the same terms as Perl itself.