X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FCLIFormatter.pm;fp=src%2FPVE%2FCLIFormatter.pm;h=ccecfc3af5fa90836670a50837bccc23014b22c6;hp=4f18fa9e58d4f85d23a6b2637779f01652aa5772;hb=99d02523f6f034760dd5e97e693a34b9ceb2a518;hpb=09d47f9d477b95382874de1233d1b012fbf4763f diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm index 4f18fa9..ccecfc3 100644 --- a/src/PVE/CLIFormatter.pm +++ b/src/PVE/CLIFormatter.pm @@ -5,7 +5,8 @@ use warnings; use I18N::Langinfo; use POSIX qw(strftime); -use CPAN::Meta::YAML; # comes with perl-modules +use YAML::XS; # supports Dumping JSON::PP::Boolean +$YAML::XS::Boolean = "JSON::PP"; use PVE::JSONSchema; use PVE::PTY; @@ -87,7 +88,7 @@ PVE::JSONSchema::register_renderer('bytes', \&render_bytes); sub render_yaml { my ($value) = @_; - my $data = CPAN::Meta::YAML::Dump($value); + my $data = YAML::XS::Dump($value); $data =~ s/^---[\n\s]//; # remove yaml marker return $data; @@ -440,7 +441,7 @@ sub print_api_result { } if ($format eq 'yaml') { - print encode('UTF-8', CPAN::Meta::YAML::Dump($data)); + print encode('UTF-8', YAML::XS::Dump($data)); } elsif ($format eq 'json') { # Note: we always use utf8 encoding for json format print to_json($data, {utf8 => 1, allow_nonref => 1, canonical => 1 }) . "\n";