NAME

ETL::Yertl::Format - Base class for input/output formats

VERSION

version 0.043

SYNOPSIS

    use ETL::Yertl::Format;
    my $json_format = ETL::Yertl::Format->get( "json" );
    my $default_format = ETL::Yertl::Format->get_default;

DESCRIPTION

Formatters handle parsing input strings into document hashes and formatting document hashes into output strings.

Formatter objects are given to ETL::Yertl::FormatStream objects.

METHODS

get

    my $format = ETL::Yertl::Format->get( $name, %args );

Get the formatter with the given name. $name should be the last word in the ETL::Yertl::Format subclass (like yaml for ETL::Yertl::Format::yaml). %args will be passed-in to the formatter constructor.

get_default

    my $format = ETL::Yertl::Format->get_default;

Get the default format for Yertl programs to communicate with each other. By default, this is YAML, but it can be set to JSON by setting the YERTL_FORMAT environment variable to "json".

Setting the default format to something besides YAML can help interoperate with other programs like jq or recs.

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.