Closed jasonjayr closed 5 years ago
Yes, I think omitting the tag when $DumpCode
is 0 would be a valid behaviour. On the other hand, that doesn't match what YAML.pm and YAML::Syck do.
To fix this, we could just ignore the code tag in Load
for now instead of dying.
Implementing $LoadCode
in XS is not trivial, but should be doable by looking at YAML::Syck or Storable.
I just released YAML::XS 0.74_001 with support for $YAML::XS::LoadCode
. I did it via a call to a perl function as this was the easiest thing to do.
Released 0.75
The Dump function, whether or not DumpCode is set, will emit tagged scalars when it encounters a code ref. Trying to Load that yaml back in, will trigger this error:
YAML::XS::LoadCode seems to not be referenced anywhere except in the documentation and does nothing useful.
Would it be legit to patch DumpCode = 0 to skip over code refs (or perhaps, if set to -1 to maintain current behavior)? To get code to load back in properly, all that's needed is an eval in the .xs?