diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-28 22:01:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-28 22:36:14 -0400 |
commit | 6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11 (patch) | |
tree | d0f3614f89a3a8162eae96ffba816e6a1f52680d /IkiWiki/Setup/Yaml.pm | |
parent | e9c38d16fc587ccd5ab08166253afdc9363de65b (diff) | |
download | ikiwiki-6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11.tar ikiwiki-6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11.tar.gz |
Switch to YAML::XS to work around insanity in YAML::Mo. Closes: #657533
https://rt.cpan.org/Ticket/Display.html?id=74487
Gave up trying to support multiple YAML backends. The XS one requires ugly
manual encoding to get unicode right, and doesn't allow dumping yaml
fragments w/o the yaml header, but at least it doesn't randomly crash
on import like YAML::Mo has started to.
Diffstat (limited to 'IkiWiki/Setup/Yaml.pm')
-rw-r--r-- | IkiWiki/Setup/Yaml.pm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/IkiWiki/Setup/Yaml.pm b/IkiWiki/Setup/Yaml.pm index 6da93bb64..6bf20f480 100644 --- a/IkiWiki/Setup/Yaml.pm +++ b/IkiWiki/Setup/Yaml.pm @@ -11,10 +11,8 @@ sub loaddump ($$) { my $class=shift; my $content=shift; - eval q{use YAML::Any}; - eval q{use YAML} if $@; + eval q{use YAML::XS}; die $@ if $@; - $YAML::Syck::ImplicitUnicode=1; IkiWiki::Setup::merge(Load(encode_utf8($content))); } @@ -35,12 +33,12 @@ sub dumpline ($$$$) { my $type=shift; my $prefix=shift; - eval q{use YAML::Old}; - eval q{use YAML} if $@; + eval q{use YAML::XS}; die $@ if $@; - $YAML::UseHeader=0; + $YAML::XS::QuoteNumericStrings=0; - my $dump=Dump({$key => $value}); + my $dump=decode_utf8(Dump({$key => $value})); + $dump=~s/^---\n//; # yaml header, we don't want chomp $dump; if (length $prefix) { $dump=join("\n", map { $prefix.$_ } split(/\n/, $dump)); |