NAME
VS::RuleEngine::Engine - Engine declaration
SYNOPSIS
use VS::RuleEngine::Engine;
my $engine = VS::RuleEngine::Engine->new();
$engine->add_hook(hook1 => "MyApp::GetMoreData");
$engine->add_rule(rule1 => "MyApp::Rule");
$engine->add_action(action1 => "MyApp::Action");
$engine->add_rule_action(rule1 => "action1");
$engine->run();
DESCRIPTION
This class defines a VS::RuleEngine "engine". Altho it is possible using this class directly it is more readable using the declarative interface in VS::RuleEngine::Declare or loading engines using an engine loader class (which is currently not available).
INTERFACE
CLASS METHODS
- new
-
Creates a new engine.
INSTANCE METHODS
Defaults
- defaults
-
Returns the names of all default sets.
- has_defaults ( NAME )
-
Checks if the engine has a default set named NAME.
- get_defaults ( NAME )
-
Returns a hash reference with the key/value pairs for the default named NAME.
- add_defaults ( NAME => DEFAULT )
-
Registers the hash reference DEFAULTS as NAME.
Actions
- actions
-
Returns the names of all registered actions.
- has_action ( NAME )
-
Checks if the engine has a registered action with the given NAME.
- add_action ( NAME => ACTION [, DEFAULTS, arguments ... ] )
-
Registers the ACTION as NAME in the engine with arguments provided by default argument sets referenced by name in the array reference DEFAULTS and additional arguments.
Hooks
- hooks
-
Returns the names of all registered hooks.
- has_hook ( NAME )
-
Checks if the engine has a registered hook with the given NAME.
- add_hook ( NAME => HOOK [, DEFAULTS, arguments ... ] )
-
Registers the HOOK as NAME in the engine with arguments provided by default argument sets referenced by name in the array reference DEFAULTS and additional arguments.
- add_pre_hook ( NAME )
-
Adds the hook with the given NAME to the list of hooks to run before each iteration.
- add_post_hook ( NAME )
-
Adds the hook with the given NAME to the list of hooks to run after each iteration.
Inputs
- inputs
-
Returns the names of all registered inputs
- has_input ( NAME )
-
Checks if the engine has a registered input with the given NAME.
- add_input ( NAME => INPUT [, DEFAULTS, arguments ... ] )
-
Registers the INPUT as NAME in the engine with arguments provided by default argument sets referenced by name in the array reference DEFAULTS and additional arguments.
Outputs
- outputs
-
Returns the names of all registered outputs
- has_output ( NAME )
-
Checks if the engine has a registered output with the given NAME.
- add_output ( NAME => OUTPUT [, DEFAULTS, arguments ... ] )
-
Registers the OUTPUT as NAME in the engine with arguments provided by default argument sets referenced by name in the array reference DEFAULTS and additional arguments.
Rules
- rules
-
Returns the names of all registered rules
- has_rule ( NAME )
-
Checks if the engine has a registered rule with the given NAME.
- add_rule ( NAME => OUTPUT [, DEFAULTS, arguments ... ] )
-
Registers the OUTPUT as NAME in the engine with arguments provided by default argument sets referenced by name in the array reference DEFAULTS and additional arguments.
- add_rule_action ( NAME => ACTION )
-
Connects the rule NAME to the action ACTION.
- rule_order
-
Returns a list of names matching the rules in the order they'll be evaluated.
- set_rule_order ( LIST )
-
Sets which order the rules should be evaluated. The list should be the names of the rules.