Scroll to navigation

YAML::PP::Schema::Binary(3) User Contributed Perl Documentation YAML::PP::Schema::Binary(3)

NAME

YAML::PP::Schema::Binary - Schema for loading and binary data

SYNOPSIS

    use YAML::PP;
    my $yp = YAML::PP->new( schema => [qw/ + Binary /] );
    # or
    my ($binary, $same_binary) = $yp->load_string(<<'EOM');
    --- !!binary "\
      R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\
      OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\
      +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\
      AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
    --- !!binary |
      R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
      OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
      +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
      AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
    # The binary value above is a tiny arrow encoded as a gif image.
    EOM

DESCRIPTION

See <https://yaml.org/type/binary.html>

By prepending a base64 encoded binary string with the "!!binary" tag, it can be automatically decoded when loading.

Note that the logic for dumping is probably broken, see <https://github.com/perlpunk/YAML-PP-p5/issues/28>.

Suggestions welcome.

METHODS

Called by YAML::PP::Schema
2024-01-30 perl v5.40.0