Config::Model::WizardHelper - Helps to create wizard widget for config models
version 1.213
use Config::Model ; my $inst = $model -> instance ( root_class_name => 'Master', instance_name => 'test1'); my $root = $inst -> config_root ; my $wizard = $inst -> wizard_helper ( leaf_cb => sub { ... }, hash_element_cb => sub { ... } ); $wizard->start ;
This module provides a class that is able to scan a configuration tree and will call back user defined subroutines on one of the following condition:
A configuration item contains an error (mostly undefined mandatory values)
A configuration item has a important level. See level parameter for details.
important
By default, the wizard will only scan element with an intermediate experience.
intermediate
The wizard helper supports going forward and backward during the scan (to support back and next buttons on a wizard widget).
back
next
The constructor should be used only by Config::Model::Instance with the wizard_helper method.
A wizard helper will need at least two kind of call-back that must be provided by the user: a call-back for leaf elements and a call-back for hash elements (which will be also used for list elements).
These call-back must be passed when creating the wizard object (the parameters are named leaf_cb and hash_element_cb)
leaf_cb
hash_element_cb
Here are the the parameters accepted by wizard_helper:
wizard_helper
Whether to call back when an important element is found (default 1).
Specifies the experience of the element scanned by the wizard (default 'intermediate').
Subroutine called backed for leaf elements. See "Callback prototypes" in Config::Model::ObjTreeScanner for signature and details. (mandatory)
Subroutine called backed for hash elements. See "Callback prototypes" in Config::Model::ObjTreeScanner for signature and details. (mandatory)
By default, leaf_cb will be called for all types of leaf elements (i.e enum. integer, strings, ...). But you can provide dedicated call-back for each type of leaf:
enum_value_cb, integer_value_cb, number_value_cb, boolean_value_cb, uniline_value_cb, string_value_cb
Likewise, you can also provide a call-back dedicated to list elements with list_element_cb
list_element_cb
Start the scan and perform call-back when needed. This function will return when the scan is completely done.
Set wizard in forward (default) mode.
Set wizard in backward mode.
Dominique Dumont, (ddumont at cpan dot org)
Config::Model, Config::Model::Instance, Config::Model::Node, Config::Model::HashId, Config::Model::ListId, Config::Model::Value, Config::Model::CheckList, Config::Model::ObjTreeScanner,
To install Config::Model, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Model
CPAN shell
perl -MCPAN -e shell install Config::Model
For more information on module installation, please visit the detailed CPAN module installation guide.