Revision fb974d9c
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
SL/Menu.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
|
5 | 5 |
use SL::Auth; |
6 |
use YAML::XS ();
|
|
6 |
use YAML (); |
|
7 | 7 |
use File::Spec; |
8 | 8 |
use SL::MoreCommon qw(uri_encode); |
9 | 9 |
|
10 |
our $yaml_xs; |
|
11 |
BEGIN { |
|
12 |
$yaml_xs = eval { require YAML::XS }; |
|
13 |
} |
|
14 |
|
|
10 | 15 |
sub new { |
11 | 16 |
my ($package, $domain) = @_; |
12 | 17 |
|
... | ... | |
19 | 24 |
my $nodes = []; |
20 | 25 |
my $nodes_by_id = {}; |
21 | 26 |
for my $file (@files) { |
22 |
my $data = YAML::XS::LoadFile(File::Spec->catfile($path, $file)); |
|
27 |
my $data; |
|
28 |
if ($yaml_xs) { |
|
29 |
$data = YAML::XS::LoadFile(File::Spec->catfile($path, $file)); |
|
30 |
} else { |
|
31 |
$data = YAML::LoadFile(File::Spec->catfile($path, $file)); |
|
32 |
} |
|
23 | 33 |
_merge($nodes, $nodes_by_id, $data); |
24 | 34 |
} |
25 | 35 |
|
Auch abrufbar als: Unified diff
Menu: YAML::XS benutzen wenn vorhanden