NAME
PNI::Scenario - is a set of nodes connected by edges
SYNOPSIS
use PNI;
my $scenario = PNI::root->add_scenario;
my $sub_sccenario = $scenario->add_scenario;
# You can call the constructor to get a scenario ...
use PNI::Scenario;
$standalone_scenario = PNI::Scenario->new;
# ... but it will not belong to PNI hierarchy tree,
# so its task method will not be called.
ATTRIBUTES
edges
nodes
scenarios
METHODS
add_edge
add_node
# Suppose 'Foo::Bar' is a valid PNI node type,
# create a new PNI::Node::Foo::Bar
my $node_foo_bar = $scenario->add_node( type => 'Foo::Bar' );
Adds a new node, given a PNI node type. PNI::Scenario checks if PNI node type is valid, then initializes it.
my $dummy_node = $scenario->add_node;
If arg type is not provided, creates a dummy node: it can be useful for tests, and you can also decorate it later.
$node = $scenario->add_node(
type => 'Perlfunc::Print',
inputs => {
list => [ 'Hello World!' ],
do_print => 1,
}
);
An additional inputs arg, if provided, is used to set node inputs data before running the first node task.
add_scenario
my $sub_scenario = $scenario->add_scenario;