load YAML on demand

so as not to break test suite if YAML is not avilable
master
Joey Hess 2010-03-19 16:09:07 -04:00
parent 07bb08d094
commit 3b08789e6f
1 changed files with 5 additions and 1 deletions

View File

@ -5,18 +5,22 @@ package IkiWiki::Setup::Yaml;
use warnings; use warnings;
use strict; use strict;
use IkiWiki; use IkiWiki;
use YAML;
sub loaddump ($$) { sub loaddump ($$) {
my $class=shift; my $class=shift;
my $content=shift; my $content=shift;
eval q{use YAML};
die $@ if $@;
IkiWiki::Setup::merge(Load($content)); IkiWiki::Setup::merge(Load($content));
} }
sub gendump ($@) { sub gendump ($@) {
my $class=shift; my $class=shift;
eval q{use YAML};
die $@ if $@;
"# IkiWiki::Setup::Yaml - YAML formatted setup file", "# IkiWiki::Setup::Yaml - YAML formatted setup file",
"#", "#",
(map { "# $_" } @_), (map { "# $_" } @_),