New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop claiming Load/DumpCode can be coderefs when they can't #181

Merged
merged 1 commit into from Oct 25, 2017
Jump to file or symbol
Failed to load files and symbols.
+1 −36
Diff settings

Always

Just for now

Copy path View file
@@ -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
Copy path View file
@@ -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
Copy path View file
@@ -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
ProTip! Use n and p to navigate between commits in a pull request.