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

ETL::Yertl::InputSeries - Read a series of input streams

VERSION

version 0.044

SYNOPSIS

use ETL::Yertl;
use ETL::Yertl::InputSeries;
my $series = ETL::Yertl::InputSeries->new(
    streams => [ \*STDIN, "/path/to/file.yaml" ],
    on_doc => sub {
        my ( $self, $doc, $eof ) = @_;
        # ... do something with $doc
    },
    on_child_eof => sub {
        my ( $self ) = @_;
        say STDERR "Switching stream";
    },
    on_read_eof => sub {
        my ( $self ) = @_;
        # All streams have been exhausted
        $self->loop->stop;
    },
);

use IO::Async::Loop;
my $loop = IO::Async::Loop->new;
$loop->add( $series );
$loop->run;

DESCRIPTION

This module reads a series of input streams in the default format (determined by "get_default" in ETL::Yertl::Format). Input streams can be filehandles (like STDIN) or paths to files.

SEE ALSO

ETL::Yertl::FormatStream

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.