From 6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 28 Jan 2012 22:01:49 -0400 Subject: 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. --- IkiWiki/Setup/Yaml.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'IkiWiki/Setup') 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)); -- cgit v1.2.3