VUser::ExtHandler - vuser extension handler.


 my $eh = VUser::ResultSet->new($cfg);
 my @resultsets = ();
 eval { @resultsets = $eh->run_tasks($keyword, $action, $cfg); };
 die $@ if $@;

Extension usage

 sub init {
     # $eh is a VUser::ExtHandler
     my ($cfg, $opts, $action, $eh) = @_;
     $eh->register_keyword('foo', 'Manage foos');
         VUser::Meta->new('name' => 'bar',
                          'type' => 'string',
                          'description' => 'Where to drink'));
         VUser::Meta->new('name' => 'drink',
                          'type' => 'string',
                          'description' => 'What to drink'));
     $eh->register_action('foo', 'add', 'Add a foo');
     $eh->register_option('foo', 'add',           # Required option
                          $eh->get_meta('foo', 'bar'), 'req');
     $eh->register_option('foo', 'add',           # Optional
                          $eh->get_meta('foo', 'bar'));
     $eh->register_task('foo', 'add', \&foo_add);
 sub foo_add {}


VUser::ExtHandler is the main control system for vuser extensions.

new($cfg[, $log])

Create a new VUser::ExtHandler object.

new() takes two options. The first is a reference to a Config::IniFiles tied hash for the vuser configuration. The second, option argument is a VUser::Log object. If it's not defined, the ExtHandler will look to see if $main::log is a VUser::Log and use that instead. If it's not, the ExtHandler will create it's own VUser::Log object.


Load extensions listed in the configuration file.

$cfg is a reference to a Config::IniFiles tied hash.

load_extensions_list($cfg, @extensions)

Load a given list of extentions.


Reference to a Config::IniFiles tied hash.


List of extension names.

register_keyword($keyword[, $description])

Register a keyword.


A description for this keyword that will be displayed by vuser help

register_meta($keyword, $meta)

Register a VUser::Meta object with the ExtHandler. Other extensions can access the object with get_meta().


The keyword to lookup meta data for.


The name of the meta data object to get.x

register_action($keyword, $action, $description)

Register an action with the ExtHandler.


The keyword to add an action to.


The action to register.

As a special case, $action can be defined as a wildcard with '*'. Wildcard actions are run for any unknown action.


A description of the action to be displayed with vuser help.

register_option($keyword, $action, $meta[, $required])

Register an option for a keyword|action pair.


A VUser::Meta object that defined the option.

$required (Optional)

If set to a true value, the option is required; otherwise the option is optional and may be omitted.

register_task($keyword, $action, $task[, $priority])

Register a fuction to be run for the keyword|action pair


$task is a sub reference that is called with four arguments.

A reference to the Config::IniFiles hash
A reference to a hash containing the options
The action run. Usuful if handling wildcard actions.
A reference to the VUser::ExtHandler that is running the tasks
$priority (Optional)

The priority of the task to run. Tasks will be run in order of priority (smaller numbers first) with tasks of equal priority run in the order they were registered.

$proirity can be set to negative numbers to lower the priority or '+ N' to increase the priority by N. (Note the space between '+' and the number.) The lowest priority is zero.

You can get the default priority by calling $eh-DEFAULT_PRIORITY;>.



get_meta($keyword, $meta_name)


get_options($keyword, $action)

get_description($keyword[, $action[, $option]])


Randy Smith <>


 This file is part of vuser.
 vuser is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 vuser is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with vuser; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 753:

Unknown directive: =over4

Around line 755:

'=item' outside of any '=over'