VUser::ExtHandler - vuser extension handler.
my $eh = VUser::ResultSet->new($cfg); $eh->load_extentions($cfg); my @resultsets = (); eval { @resultsets = $eh->run_tasks($keyword, $action, $cfg); }; die $@ if $@; $eh->cleanup();
Extension usage
sub init { # $eh is a VUser::ExtHandler my ($cfg, $opts, $action, $eh) = @_; $eh->register_keyword('foo', 'Manage foos'); $eh->register_meta('foo', VUser::Meta->new('name' => 'bar', 'type' => 'string', 'description' => 'Where to drink')); $eh->register_meta('foo', 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.
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.
$main::log
Load extensions listed in the configuration file.
$cfg is a reference to a Config::IniFiles tied hash.
$cfg
Load a given list of extentions.
Reference to a Config::IniFiles tied hash.
List of extension names.
Register a keyword.
A description for this keyword that will be displayed by vuser help
vuser help
Register a VUser::Meta object with the ExtHandler. Other extensions can access the object with get_meta().
get_meta()
The keyword to lookup meta data for.
The name of the meta data object to get.x
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.
$action
A description of the action to be displayed with vuser help.
Register an option for a keyword|action pair.
A VUser::Meta object that defined the option.
If set to a true value, the option is required; otherwise the option is optional and may be omitted.
Register a fuction to be run for the keyword|action pair
$task is a sub reference that is called with four arguments.
$task
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.
$proirity
You can get the default priority by calling $eh-DEFAULT_PRIORITY;>.
$eh-
Randy Smith <perlstalker@vuser.org>
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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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:
Unknown directive: =over4
'=item' outside of any '=over'
To install VUser::ACL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VUser::ACL
CPAN shell
perl -MCPAN -e shell install VUser::ACL
For more information on module installation, please visit the detailed CPAN module installation guide.