]> git.proxmox.com Git - pve-common.git/commitdiff
cli handler: contain no-stricture scope
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Apr 2023 13:09:20 +0000 (15:09 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Apr 2023 13:09:22 +0000 (15:09 +0200)
to please perlcritic's highest severity level and as it makes just
sense to contain such things to the smallest possible scope.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/CLIHandler.pm

index 64de8f783d552d0a12a000cffb462b8402492e9a..f96bcf615f0dc574fc06222af5ebade07fadfc4e 100644 (file)
@@ -538,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'] ];
@@ -660,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);