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

transerialize - transerialize files from a format to a different one

VERSION

version 1.2.0

SYNOPSIS

    # simple
    $ transerialize foo.yaml bar.json

    # with options
    $ transerialize pretty=1 foo.yaml bar.json

    # reading from STDIN
    $ cat foo.yaml | transerialize -.yaml bar.json

    # printing to STDOUT
    $ transerialize foo.yaml -.json

DESCRIPTION

transerialize is a command-line interface to the File::Serialize function of the same name.

The command behaves pretty much like its underlying function, except for the details below.

Default options

All leading arguments containing an '=' will be considered default options. In other words,

    $ transerialize pretty=1 format=json foo bar

is equivalent to the script

    use File::Serialize { pretty => 1, format => 'json' };

    transerialize_file 'foo' => 'bar';

Code arguments

Any argument that begin with a '{', '[' or 'sub {' will be eval'ed (as opposed as being considered filenames).

STDIN and STDOUT

An input filename which main part is a dash will be taken to be STDIN. For example

    $ transerialize_file -.yaml foo.json

will read STDIN, consider it to be YAML, and then convert it to JSON.

Likewise, an output file which main part is a dash will be printed on STDOUT. For example

    $ transerialize_file foo.yaml -.json

will print out the data of foo.yaml as JSON.

AUTHOR

Yanick Champoux <yanick@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017, 2016, 2015 by Yanick Champoux.

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