Back to documentation
#!/usr/bin/env perl
package yto;
our $VERSION = '0.038';
# ABSTRACT: Change YAML to another format (like JSON)

use ETL::Yertl;
use Pod::Usage::Return qw( pod2usage );
use Getopt::Long qw( GetOptionsFromArray );
use ETL::Yertl::Command::yto;

$|++; # no buffering

sub main {
    my ( $class, @argv ) = @_;
    my %opt;
    GetOptionsFromArray( \@argv, \%opt,
    return pod2usage(0) if $opt{help};
    if ( $opt{version} ) {
        print "yto version $yto::VERSION (Perl $^V)\n";
        return 0;

    eval {
        ETL::Yertl::Command::yto->main( @argv, \%opt );
    if ( $@ ) {
        return pod2usage( "ERROR: $@" );
    return 0;

exit __PACKAGE__->main( @ARGV ) unless caller(0);



    yto <format> [<file>...]

    yto csv [-d <delimiter>] [<file>...]

    yto -h|--help|--version


This program takes a stream of YAML documents (on STDIN or file arguments),
and prints them in the desired format.


=head2 format

The format to output. Currently supported formats: JSON

=head2 <file>

A YAML file to read. The special file "-" refers to STDIN. If no files are
specified, read STDIN.

=head1 OPTIONS

=head2 -d | --delimiter

The delimiter to use for the C<csv> format. Defaults to C<,>.

=head2 -h | --help

Show this help document.

=head2 --version

Print the current yto and Perl versions.


=over 4


Specify the default format Yertl uses between commands. Defaults to C<yaml>. Can be
set to C<json> for interoperability with other programs.