Data-Tubes

 view release on metacpan or  search on metacpan

lib/Data/Tubes/Plugin/Source.pod  view on Meta::CPAN


name for the tube, useful for debugging;

=item C<output>

name of the output field in the returned record, defaults to C<source>.

=back

=head2 B<< iterate_files >>

   my $tube = iterate_files(@channels_list); # OR
   my $tube = iterate_files(@channels_list, \%args);

generate a tube that iterates over a list of files, either provided to
the factory function directly, or provided as a reference to an array
when invoking the tube. The two following cases are equivalent:

   # pass the file list to the factory
   my $tube1 = iterate_files('foo.txt', 'bar.txt');
   my (undef, $iterator) = $tube1->();

   # leave factory without list, pass to the tube
   my $tube2 = iterate_files();
   my (undef, $iterator)= $tube2->(['foo.txt', 'bar.txt']);

All elements in C<@channels_list> MUST be valid channels for the tube
generated by L</open_file>. Optionally, the last item in the argument
list can be a reference to a hash, with further options for the factory.

The factory is built as a C<sequence> (see
L<Data::Tubes::Plugin::Plumbing>) of L</iterate_array>, L</open_file>
and a C<logger> (see L<Data::Tubes::Plugin::Plumbing> for the latter).

The following arguments can be (optionally) supplied via C<%args>:

=over

=item C<iterate_array>

optional hash with arguments for L</iterate_array>, where the C<array>
field is overridden with C<@channels_list>;

=item C<logger>

optional hash with arguments for C<logger> in
L<Data::Tubes::Plugin::Plubming>. Defaults to setting a C<target>
pointing to a sub reference that gives out message
C<reading from %s>, where C<%s> is expanded with the content of
C<< $record->{source}{name} >>;

=item C<name>

=item C<open_file>

optional hash with arguments for the L</open_file> sub-tube, defaults to
the empty hash which means taking all defaults from L</open_file>.

=back

=head1 BUGS AND LIMITATIONS

Report bugs either through RT or GitHub (patches welcome).

=head1 AUTHOR

Flavio Poletti <polettix@cpan.org>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2016 by Flavio Poletti <polettix@cpan.org>

This module is free software. You can redistribute it and/or modify it
under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

=cut



( run in 0.588 second using v1.01-cache-2.11-cpan-39bf76dae61 )