[pve-devel] r5168 - pve-common/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Sep 17 10:42:35 CEST 2010


Author: dietmar
Date: 2010-09-17 08:42:35 +0000 (Fri, 17 Sep 2010)
New Revision: 5168

Modified:
   pve-common/trunk/ChangeLog
   pve-common/trunk/RESTHandler.pm
Log:


Modified: pve-common/trunk/ChangeLog
===================================================================
--- pve-common/trunk/ChangeLog	2010-09-17 06:50:20 UTC (rev 5167)
+++ pve-common/trunk/ChangeLog	2010-09-17 08:42:35 UTC (rev 5168)
@@ -1,3 +1,7 @@
+2010-09-17  Proxmox Support Team  <support at proxmox.com>
+
+	* RESTHandler.pm (AUTOLOAD): bug fix.
+
 2010-09-15  Proxmox Support Team  <support at proxmox.com>
 
 	* RPCEnvironment.pm (fork_worker): moved from PVE::Utils

Modified: pve-common/trunk/RESTHandler.pm
===================================================================
--- pve-common/trunk/RESTHandler.pm	2010-09-17 06:50:20 UTC (rev 5167)
+++ pve-common/trunk/RESTHandler.pm	2010-09-17 08:42:35 UTC (rev 5168)
@@ -1,6 +1,8 @@
 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);
@@ -62,24 +64,22 @@
 }
 
 sub AUTOLOAD {
-    my $this = shift;
+    my ($this) = @_;
 
-    my $method = $AUTOLOAD;
-
     # also see "man perldiag"
-    my $class = ref($this) || die "no such method '$method'";
+ 
+    my $sub = $AUTOLOAD;
+    (my $method = $sub) =~ s/.*:://;
 
     $method =~ s/.*:://;
 
-    my $info = $class->map_method_by_name($method);
+    my $info = $this->map_method_by_name($method);
 
-    *$AUTOLOAD = sub {
+    *{$sub} = sub {
 	my $self = shift;
-
 	return $self->handle($info, @_);
     };
     goto &$AUTOLOAD;
-
 }
 
 sub method_attributes {



More information about the pve-devel mailing list