NAME
PNI::Scenario - is a set of nodes connected by edges
SYNOPSIS
use PNI::Scenario;
my $scenario = PNI::Scenario->new;
# Add two nodes.
my $foo = $scenario->add_node('Foo');
my $bar = $scenario->add_node('Bar');
# Connect nodes with an edge.
$scenario->add_edge( source => $foo->out, target => $bar->in );
# Run your task.
$scenario->task;
DESCRIPTION
A scenario is a directed graph of subs called task
.
ATTRIBUTES
edges
my @edges = $scenario->edges->list;
A PNI::Set containing <PNI::Edge>s.
nodes
my @nodes = $scenario->nodes->list;
A PNI::Set containing <PNI::Node>s.
scenarios
my @scenarios = $scenario->scenarios->list;
A PNI::Set containing <PNI::Scenario>s.
METHODS
add_edge
add_node
add_scenario
$sub_scenario = $scenario->add_scenario;
by_id
use PNI::Scenario;
my $scenario = PNI::Scenario::by_id($scenario_id);
Given a scenario id, returns a reference to the scenario.
del_edge
del_node
del_scenario
task
$scen->task;
Probably the most important PNI method. The task of a scenario is to trigger every node (and scenario) it contains to run its own task, following the natural order.
to_hashref
my $scenario_hashref = $scen->to_hashref;
Returns an hash ref representing the scenario.