Data-Roundtrip

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    It returns 1 on success or 0 on failure.

 write_to_filehandle

      write_to_filehandle($filehandle, $contents) or die

    Arguments:

      * $filehandle : the handle to an already opened file (for writing).

    Return value:

      * 1 on success or 0 on failure.

    It writes content to the specified file handle. Upon return the file
    handle is still open.

    It returns 1 on success or 0 on failure.

SCRIPTS

    A few scripts have been put together and offer the functionality of
    this module to the command line. They are part of this distribution and
    can be found in the script directory.

    These are: json2json.pl, json2yaml.pl, yaml2json.pl, json2perl.pl,
    perl2json.pl, yaml2perl.pl

CAVEATS

    I have to apologise here to the authors of YAML::PP for defaming them
    because I clumsily wrote YAML::PP when I wanted to write YAML.

    So, the reality is that YAML::PP does not have any problem in handling
    the edge-case below.

    A valid Perl variable may kill YAML's Load() because of escapes and
    quotes. For example this:

        my $yamlstr = <<'EOS';
        ---
        - 682224
        - "\"w": 1
        EOS
        my $pv = eval { YAML::Load($yamlstr) };
        if( $@ ){ die "failed(1): ". $@ }
        # it's dead

    Strangely, there is no problem for this:

        my $yamlstr = <<'EOS';
        ---
        - 682224
        - "\"w"
        EOS
        # this is OK also:
        # - \"w: 1
        my $pv = eval { YAML::Load($yamlstr) };
        if( $@ ){ die "failed(1): ". $@ }
        # it's OK! still alive.

    I have provided an author-only test (make deficiencies) which tests all
    three of them on the edge cases. Both YAML::PP and YAML::XS pass the
    tests.

    This YAML issue <https://github.com/ingydotnet/yaml-pm/issues/224> is
    relevant. Many thanks to CPAN authors TINITA
    <https://metacpan.org/author/TINITA> and INGY
    <https://metacpan.org/author/INGY> for their work on this, and on YAML*
    too.

    For now, the plan is to still use YAML::PP and avoid explicitly
    requiring YAML::XS until YAML::Any is ready.

    Be warned that sub dump2perl() eval()'s its input. If this comes from
    the user and it is not checked then it is considered a security
    problem. Subs dump2json(), dump2yaml(), dump2dump() use dump2perl().
    The four subs will issue a warning whenever you call them.
    Additionally, as from version 0.28, they need to be explicitly imported
    like:

        use Data::Roundtrip qw/... dump2perl .../

    They are no longer part of export tag :dump nor :all. If their input
    comes from the user please check the input not to contain malicious
    code which when eval()'ed can create security concerns.

AUTHOR

    Andreas Hadjiprocopis, <bliako at cpan.org> / <andreashad2 at
    gmail.com>

BUGS

    Please report any bugs or feature requests to bug-data-roundtrip at
    rt.cpan.org, or through the web interface at
    https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Roundtrip. I will
    be notified, and then you'll automatically be notified of progress on
    your bug as I make changes.

SEE ALSO

    Convert JSON to Perl and back with unicode
    <https://perlmonks.org/?node_id=11115241>

    RFC: Perl<->JSON<->YAML<->Dumper : roundtripping and possibly with
    unicode <https://perlmonks.org/?node_id=11115280>

SUPPORT

    You can find documentation for this module with the perldoc command.

        perldoc Data::Roundtrip

    You can also look for information at:

      * RT: CPAN's request tracker (report bugs here)

      https://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Roundtrip



( run in 2.420 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )