Subject: | Doesn't serialize coderefs |
Currently there is no way to get a coderef serialized in a useful way.
The default output format just stringifies the reference resulting in
CODE(0xaddr). The dump and dumper output methods generate valid perl
code, but when you run the generated code again it just doesn't do
anything useful as this output methods don't dump the coderefs body
resulting in:
$VAR1 = sub { "DUMMY" };
or
sub { "???" }
Also yaml gets it wrong for the same reason:
--- !!perl/code '{ "DUMMY" }'
Please include a possibility to get coderefs dumped in a useful manner.
For yaml setting $YAML::DumpCode to something true would do the job for
yaml. I have no idea how to make this work for dump and dumper though.
Maybe they have some hook that allows to plug in B::Deparse. Also note
that Data::Dump::Streamer gets it right:
perl -MData::Dump::Streamer -e'Dump(sub { print 1 })'
$CODE1 = sub {
print 1;
};