YAML::PP::Schema::Binary(3) | User Contributed Perl Documentation | YAML::PP::Schema::Binary(3) |
YAML::PP::Schema::Binary - Schema for loading and binary data
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
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.
2020-09-10 | perl v5.34.0 |