laziness, impatience, and hubris | |
PerlMonks |
Bug in YAML::Any - What to do?by bv (Friar) |
on Dec 14, 2009 at 22:51 UTC ( [id://812779]=perlquestion: print w/replies, xml ) | Need Help?? |
bv has asked for the wisdom of the Perl Monks concerning the following question: So I found what I believe to be a bug in YAML::Any, specifically in the Dump function, but I suspect that the nearly identical code in DumpFile, Load, and LoadFile are also buggy. The intention of the code in question is to apply the settings of the $YAML::Option global options to the chosen implementation of YAML (in my case, YAML::XS). Here is the code, with my debug statements marked:
My test code:
The "Name used only once" warning is not the issue, since I get the same warning when setting $YAML::XS::UseCode directly, and the output is what I would expect (The output of B::Deparse on the CODE reference); What I believe is the issue is that each global option is localized within the for loop, and immediately returns to its previous value upon the next iteration. What I need is a solution to localize the value such that it stays set for the function call that is returned in the last line. So my questions are twofold:
Thanks much! My environment: YAML-0.70, YAML-LibYAML-0.32, "This is perl, v5.10.0 built for i486-linux-gnu-thread-multi" UPDATE: My workaround is to use YAML::Any's implementation() method and cheat with strict refs:
Back to
Seekers of Perl Wisdom
|
|