[pve-devel] r6448 - in pve-common/trunk: . data data/PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Aug 10 13:48:11 CEST 2011


Author: dietmar
Date: 2011-08-10 13:48:11 +0200 (Wed, 10 Aug 2011)
New Revision: 6448

Modified:
   pve-common/trunk/README.dev
   pve-common/trunk/data/ChangeLog
   pve-common/trunk/data/PVE/CLIHandler.pm
   pve-common/trunk/data/PVE/RESTHandler.pm
Log:
	* PVE/RESTHandler.pm (cli_handler): renamed cli_handler2 to
	cli_handler.



Modified: pve-common/trunk/README.dev
===================================================================
--- pve-common/trunk/README.dev	2011-08-10 10:31:42 UTC (rev 6447)
+++ pve-common/trunk/README.dev	2011-08-10 11:48:11 UTC (rev 6448)
@@ -139,14 +139,10 @@
 We use Perl's AUTOLOAD feature to implement this. Note: You need to
 pass parameters a HASH reference.
 
-There is a special helper method for command line tools, where you
-want to pass arguments as array of strings:
+There is a special helper method called cli_handler(). This is used by
+the CLIHandler Class for command line tools, where you want to pass
+arguments as array of strings. This uses Getopt::Long to parse parameters.
 
-  my $args = ['-text', 'a test"];
-  print __PACKAGE__->cli_handler('echo', $args);
-
-Note:: This uses Getopt::Long to parse parameters.
-
 There is a second way to map names to methods - using the 'path'
 property.  And you can register subclasses. That way you can set up a
 filesystem like hierarchy to access methods. 

Modified: pve-common/trunk/data/ChangeLog
===================================================================
--- pve-common/trunk/data/ChangeLog	2011-08-10 10:31:42 UTC (rev 6447)
+++ pve-common/trunk/data/ChangeLog	2011-08-10 11:48:11 UTC (rev 6448)
@@ -1,5 +1,8 @@
 2011-08-10  Proxmox Support Team  <support at proxmox.com>
 
+	* PVE/RESTHandler.pm (cli_handler): renamed cli_handler2 to
+	cli_handler.
+
 	* PVE/CLIHandler.pm (print_pod_manpage): add method to generate
 	pod base manual pages (SYNOPSIS is auto generated).
 

Modified: pve-common/trunk/data/PVE/CLIHandler.pm
===================================================================
--- pve-common/trunk/data/PVE/CLIHandler.pm	2011-08-10 10:31:42 UTC (rev 6447)
+++ pve-common/trunk/data/PVE/CLIHandler.pm	2011-08-10 11:48:11 UTC (rev 6448)
@@ -199,7 +199,7 @@
     }
 
     my $prefix = "$exename $cmd";
-    my $res = $class->cli_handler2($prefix, $name, \@ARGV, $arg_param, $uri_param, $pwcallback);
+    my $res = $class->cli_handler($prefix, $name, \@ARGV, $arg_param, $uri_param, $pwcallback);
     if ($outsub) {
 	&$outsub($res);
     }

Modified: pve-common/trunk/data/PVE/RESTHandler.pm
===================================================================
--- pve-common/trunk/data/PVE/RESTHandler.pm	2011-08-10 10:31:42 UTC (rev 6447)
+++ pve-common/trunk/data/PVE/RESTHandler.pm	2011-08-10 11:48:11 UTC (rev 6448)
@@ -493,7 +493,7 @@
     return $out;
 }
 
-sub cli_handler2 {
+sub cli_handler {
     my ($self, $prefix, $name, $args, $arg_param, $fixed_param, $pwcallback) = @_;
 
     my $info = $self->map_method_by_name($name);
@@ -526,16 +526,6 @@
     return $res;
 }
 
-sub cli_handler {
-    my ($self, $name, $args, $uri_param, $pwcallback) = @_;
-
-    my $info = $self->map_method_by_name($name);
-
-    my $param = PVE::JSONSchema::get_options($info->{parameters}, $args, $uri_param, $pwcallback);
-
-    return $self->handle($info, $param);
-}
-
 # utility methods
 # note: this modifies the original hash by adding the id property
 sub hash_to_array {



More information about the pve-devel mailing list