]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/CLIHandler.pm
cert: fix invalid CSR version
[pve-common.git] / src / PVE / CLIHandler.pm
index 9955d77e06395c85dd219dac7d9f322bc1824992..f96bcf615f0dc574fc06222af5ebade07fadfc4e 100644 (file)
@@ -208,7 +208,7 @@ sub generate_usage_str {
        my $str = '';
        if (ref($def) eq 'HASH') {
            my $oldclass = undef;
-           foreach my $cmd (&$sortfunc($def)) {
+           foreach my $cmd ($sortfunc->($def)) {
 
                if (ref($def->{$cmd}) eq 'ARRAY') {
                    my ($class, $name, $arg_param, $fixed_param, undef, $formatter_properties) = @{$def->{$cmd}};
@@ -350,7 +350,7 @@ sub print_usage_short {
 
     print {$fd} generate_usage_str('short', $cmd, ' ' x 7, $cmd ? '' : "\n", sub {
        my ($h) = @_;
-       return sort {
+       my @sorted_commands = sort {
            if (ref($h->{$a}) eq 'ARRAY' && ref($h->{$b}) eq 'ARRAY') {
                # $a and $b are both real commands order them by their class
                return $h->{$a}->[0] cmp $h->{$b}->[0] || $a cmp $b;
@@ -362,6 +362,7 @@ sub print_usage_short {
                return $a cmp $b;
            }
        } keys %$h;
+       return @sorted_commands;
     });
 }
 
@@ -537,11 +538,12 @@ sub generate_asciidoc_synopsis {
 
     $exename = &$get_exe_name($class);
 
-    no strict 'refs';
-    my $def = ${"${class}::cmddef"};
-    $cmddef = $def;
+    {
+       no strict 'refs'; ## no critic (ProhibitNoStrict)
+       $cmddef = ${"${class}::cmddef"};
+    }
 
-    if (ref($def) eq 'ARRAY') {
+    if (ref($cmddef) eq 'ARRAY') {
        print_simple_asciidoc_synopsis();
     } else {
        $cmddef->{help} = [ __PACKAGE__, 'help', ['cmd'] ];
@@ -659,8 +661,10 @@ sub run_cli_handler {
     my $logid = $ENV{PVE_LOG_ID} || $exename;
     initlog($logid);
 
-    no strict 'refs';
-    $cmddef = ${"${class}::cmddef"};
+    {
+       no strict 'refs'; ## no critic (ProhibitNoStrict)
+       $cmddef = ${"${class}::cmddef"};
+    }
 
     if (ref($cmddef) eq 'ARRAY') {
        $handle_simple_cmd->(\@ARGV, $preparefunc, $param_cb);