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;

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_hash

my $data_hashref = $scen->to_hash;