Config::Model::WizardHelper - Helps to create wizard widget for config models


NAME

Config::Model::WizardHelper - Helps to create wizard widget for config models


SYNOPSIS

 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 ;


DESCRIPTION

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:

By default, the wizard will only scan element with an intermediate permission.

The wizard helper supports going forward and backward during the scan (to support back and next buttons on a wizard widget).


CONSTRUCTOR

The constructor should be used only by the Config::Model::Instance manpage with the wizard_helper method.


Creating a wizard helper

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)

Here are the the parameters accepted by wizard_helper:

call_back_on_important

Whether to call back when an important element is found (default 1).

permission

Specifies the permission of the element scanned by the wizard (default 'intermediate').

leaf_cb

Subroutine called backed for leaf elements. See Callback prototypes in the Config::Model::ObjTreeScanner manpage for signature and details. (mandatory)

hash_element_cb

Subroutine called backed for hash elements. See Callback prototypes in the Config::Model::ObjTreeScanner manpage for signature and details. (mandatory)


Custom callbacks

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


Methods

start

Start the scan and perform call-back when needed. This function will return when the scan is completely done.

go_forward

Set wizard in forward (default) mode.

go_backward

Set wizard in backward mode.


AUTHOR

Dominique Dumont, (ddumont at cpan dot org)


SEE ALSO

the Config::Model manpage, the Config::Model::Instance manpage, the Config::Model::Node manpage, the Config::Model::HashId manpage, the Config::Model::ListId manpage, the Config::Model::Value manpage, the Config::Model::CheckList manpage, the Config::Model::ObjTreeScanner manpage,

 Config::Model::WizardHelper - Helps to create wizard widget for config models