6 sub _choose_yaml_module {
 
   7   return 'YAML::XS' if $INC{'YAML/XS.pm'};
 
   8   return 'YAML'     if $INC{'YAML.pm'};
 
  12   return 'YAML::XS' if eval { require YAML::XS; 1; };
 
  13   push @err, "Error loading YAML::XS: $@";
 
  15   return 'YAML' if eval { require YAML; 1; };
 
  16   push @err, "Error loading YAML: $@";
 
  18   die join("\n", "Couldn't load a YAML module:", @err);
 
  22   our $YAML_Class = _choose_yaml_module();
 
  23   $YAML_Class->import(qw(Dump Load DumpFile LoadFile));
 
  26 sub YAML { our $YAML_Class }
 
  38 SL::YAML - A thin wrapper around YAML::XS and YAML
 
  44     my $menu_data = SL::YAML::LoadFile("menus/user/00-erp.yml");
 
  48 This is a thin wrapper around the YAML::XS and YAML modules. It'll
 
  49 prefer loading YAML::XS if that's found and will fallback to YAML
 
  50 otherwise. It only provides the four functions C<Dump>, C<Load>,
 
  51 C<DumpFile> and C<LoadFile> — just enough to get by for kivitendo.
 
  53 The functions are direct imports from the imported module. Please see
 
  54 the documentation for YAML::XS or YAML for details.
 
  58 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>