]> git.proxmox.com Git - pve-common.git/commitdiff
rest handler: minimize scope of no-strict-refs exemption
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Apr 2023 14:18:10 +0000 (16:18 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 11 Apr 2023 14:18:49 +0000 (16:18 +0200)
with a rough check and a slight amount of hope that nothing else in
the module dependent on turning that off for the whole module

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

index c74618151ee4f8beb6f1c9beb0686a54c05ea100..944a04b96c87c00b172c4b4ccea85fb46253e154 100644 (file)
@@ -1,7 +1,6 @@
 package PVE::RESTHandler;
 
 use strict;
-no strict 'refs'; # our autoload requires this
 use warnings;
 use PVE::SafeSyslog;
 use PVE::Exception qw(raise raise_param_exc);
@@ -329,10 +328,13 @@ sub AUTOLOAD {
 
     my $info = $this->map_method_by_name($method);
 
-    *{$sub} = sub {
-       my $self = shift;
-       return $self->handle($info, @_);
-    };
+    {
+       no strict 'refs'; ## no critic (ProhibitNoStrict)
+       *{$sub} = sub {
+           my $self = shift;
+           return $self->handle($info, @_);
+       };
+    }
     goto &$AUTOLOAD;
 }