From: Sven Schöling Date: Wed, 15 Jul 2015 16:42:24 +0000 (+0200) Subject: Menu: YAML::XS benutzen wenn vorhanden X-Git-Tag: release-3.3.0beta~31^2~21 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fb974d9c26db844c754b75506a28f3ca9f5522ca;p=kivitendo-erp.git Menu: YAML::XS benutzen wenn vorhanden --- diff --git a/SL/Menu.pm b/SL/Menu.pm index d72bb3619..1ecb52fab 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -3,10 +3,15 @@ package SL::Menu; use strict; use SL::Auth; -use YAML::XS (); +use YAML (); use File::Spec; use SL::MoreCommon qw(uri_encode); +our $yaml_xs; +BEGIN { + $yaml_xs = eval { require YAML::XS }; +} + sub new { my ($package, $domain) = @_; @@ -19,7 +24,12 @@ sub new { my $nodes = []; my $nodes_by_id = {}; for my $file (@files) { - my $data = YAML::XS::LoadFile(File::Spec->catfile($path, $file)); + my $data; + if ($yaml_xs) { + $data = YAML::XS::LoadFile(File::Spec->catfile($path, $file)); + } else { + $data = YAML::LoadFile(File::Spec->catfile($path, $file)); + } _merge($nodes, $nodes_by_id, $data); }