Config::Model::WizardHelper(3pm)

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:

•   A configuration item contains an error (mostly undefined mandatory values)

•   A configuration item has a "important" level. See level parameter for details.

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

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 Config::Model::Instance 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).

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

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

  hash_element_cb
Subroutine called backed for hash elements. See "Callback prototypes" in Config::Model::ObjTreeScanner 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
Config::Model, Config::Model::Instance, Config::Model::Node, Config::Model::HashId, Config::Model::ListId, Config::Model::Value, Config::Model::CheckList, Config::Model::ObjTreeScanner,