Permalink
Browse files

stop claiming Load/DumpCode can be coderefs when they can't

  • Loading branch information...
mohawk2 committed Oct 22, 2017
1 parent a8d33fd commit d5867a0b474dbc3c9642f2be7d5acdd184eb7f80
Showing with 1 addition and 36 deletions.
  1. +0 −9 ReadMe.pod
  2. +0 −9 doc/YAML.swim
  3. +1 −18 test/bugs-rt.t
View
@@ -383,22 +383,13 @@ default YAML.pm will dump code references as dummy placeholders (much like
Data::Dumper). If DumpCode is set to '1' or 'deparse', code references will be
dumped as actual Perl code.
DumpCode can also be set to a subroutine reference so that you can write your
own serializing routine. YAML.pm passes you the code ref. You pass back the
serialization (as a string) and a format indicator. The format indicator is a
simple string like: 'deparse' or 'bytecode'.
=item LoadCode
LoadCode is the opposite of DumpCode. It tells YAML if and how to
deserialize code references. When set to '1' or 'deparse' it will use
C<eval()>. Since this is potentially risky, only use this option if you know
where your YAML has been.
LoadCode can also be set to a subroutine reference so that you can write your
own deserializing routine. YAML.pm passes the serialization (as a string) and
a format indicator. You pass back the code reference.
=item Preserve
When set to true, this option tells the Loader to load hashes into YAML::Node
View
@@ -356,22 +356,13 @@ The current options are:
Data::Dumper). If DumpCode is set to '1' or 'deparse', code references will
be dumped as actual Perl code.
DumpCode can also be set to a subroutine reference so that you can write
your own serializing routine. YAML.pm passes you the code ref. You pass back
the serialization (as a string) and a format indicator. The format indicator
is a simple string like: 'deparse' or 'bytecode'.
- LoadCode
LoadCode is the opposite of DumpCode. It tells YAML if and how to
deserialize code references. When set to '1' or 'deparse' it will use
`eval()`. Since this is potentially risky, only use this option if you know
where your YAML has been.
LoadCode can also be set to a subroutine reference so that you can write
your own deserializing routine. YAML.pm passes the serialization (as a
string) and a format indicator. You pass back the code reference.
- Preserve
When set to true, this option tells the Loader to load hashes into YAML::Node
View
@@ -1,6 +1,6 @@
use strict;
use lib -e 't' ? 't' : 'test';
use TestYAML tests => 43;
use TestYAML tests => 42;
run_yaml_tests;
@@ -205,23 +205,6 @@ end:
=== Ticket #12955 DumpCode claims to support a code ref to serialize code, but doesn't
+++ skip_this_for_now
The DumpCode option says you can set it to a code ref to control the
serializing yourself, but this doesn't work.
$ perl -MYAML -we '
$YAML::DumpCode = sub { return "dumped code $_[0]", "test" };
print Dump(sub { "foo" });'
--- !!perl/code "{\n 'foo';\n}\n"
$ _
YAML::Transfer::code::yaml_dump() doesn't look to have any code to
support a DumpCode which is a code ref, it only tests it as a boolean.
+++ perl
=== Ticket #12959-a bug - nested inline collections with extra blanks
+++ function: load_passes
+++ yaml

0 comments on commit d5867a0

Please sign in to comment.