Data-Tubes

 view release on metacpan or  search on metacpan

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


=item C<tp_opts>

options for L<Template::Perlish>'s constructor.

=back

The following options are recognised from C<$args>:

=over

=item C<logger>

the default value for C<$opts>;

=item C<name>

the name of the tube, defaults to C<*undef*>.

=back

=head2 B<< read_file >>

   my $contents = read_file($filename, %args); # OR
   my $contents = read_file(%args); # OR
   my $contents = read_file(\%args);

See L<Data::Tubes::Util/read_file>, this is a re-export for ease of use
with L<Data::Tubes/summon> and backwards compatibility.

=head2 B<< tubify >>

   @tubes = tubify(@specifications); # OR
   @tubes = tubify(\%opts, @specifications);

automatically transform input specifications into tubes. Each item in
C<@specification> can be either a tube (i.e. a code reference), or
something that can be transformed into a tube (see L<Data::Tubes/tube>
for a definition). Additionally, whatever in C<@specification> is found
to be I<false> (in the Perl sense) will just be ignored.

Hence, this does returns the two tubes you think:

   @tubes = tubify(
      'Reader::by_line',
      ['Parser::by_format', format => 'foo,bar,baz'],
   );

Additionally, this actually does what you think:

   @tubes = tubify(
      'Reader::by_line',
      ['Parser::by_format', format => 'foo,bar,baz'],
      ($foobar && sub { die unless $_[0]->{structured}}),
   );

You can optionally pass a I<hash reference> of options as the first
parameter. This allows you to set any option available through
L<Data::Tubes/tube>, e.g. C<prefix>.

=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.427 second using v1.01-cache-2.11-cpan-39bf76dae61 )