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

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Aug 12 12:39:22 CEST 2010


Author: dietmar
Date: 2010-08-12 10:39:22 +0000 (Thu, 12 Aug 2010)
New Revision: 4972

Modified:
   pve-common/trunk/RESTHandler.pm
Log:
fix autoload


Modified: pve-common/trunk/RESTHandler.pm
===================================================================
--- pve-common/trunk/RESTHandler.pm	2010-08-11 12:12:20 UTC (rev 4971)
+++ pve-common/trunk/RESTHandler.pm	2010-08-12 10:39:22 UTC (rev 4972)
@@ -82,17 +82,24 @@
 };
 
 sub AUTOLOAD {
-    my $self = shift;
+    my $this = shift;
 
     my $method = $AUTOLOAD;
 
+    # also see "man perldiag"
+    my $class = ref($this) || die "no such method '$method'";
+
     $method =~ s/.*:://;
 
-    my $info = $self->map_method_by_name($method);
+    my $info = $class->map_method_by_name($method);
 
-    my $param = shift;
+    *$AUTOLOAD = sub {
+	my $self = shift;
 
-    return $self->$call_local_method($info, $param);
+	return $self->$call_local_method($info, @_);
+    };
+    goto &$AUTOLOAD;
+
 }
 
 sub method_attributes {



More information about the pve-devel mailing list