+};
+
+sub run_cli {
+ my ($class, $pwcallback, $podfn, $preparefunc) = @_;
+
+ # Note: "depreciated function run_cli - use run_cli_handler instead";
+ # silently ignore $podfn , which is no longer supported.
+
+ die "password callback is no longer supported" if $pwcallback;
+
+ run_cli_handler($class, prepare => $preparefunc);
+}
+
+sub run_cli_handler {
+ my ($class, %params) = @_;
+
+ $cli_handler_class = $class;
+
+ $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+
+ foreach my $key (keys %params) {
+ next if $key eq 'prepare';
+ next if $key eq 'no_init'; # not used anymore
+ next if $key eq 'no_rpcenv'; # not used anymore
+ die "unknown parameter '$key'";
+ }
+
+ my $preparefunc = $params{prepare};
+
+ my $pwcallback = $class->can('read_password');
+ my $stringfilemap = $class->can('string_param_file_mapping');
+
+ $exename = &$get_exe_name($class);
+
+ initlog($exename);
+
+ no strict 'refs';
+ my $def = ${"${class}::cmddef"};
+
+ if (ref($def) eq 'ARRAY') {
+ &$handle_simple_cmd($def, \@ARGV, $pwcallback, $preparefunc, $stringfilemap);
+ } else {
+ $cmddef = $def;
+ my $cmd = shift @ARGV;
+ &$handle_cmd($cmddef, $exename, $cmd, \@ARGV, $pwcallback, $preparefunc, $stringfilemap);
+ }
+
+ exit 0;