PNI::Scenario - is a set of nodes connected by edges
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;
A scenario is a directed graph of subs called task.
task
my @edges = $scenario->edges->list;
A PNI::Set containing <PNI::Edge>s.
my @nodes = $scenario->nodes->list;
A PNI::Set containing <PNI::Node>s.
my @scenarios = $scenario->scenarios->list;
A PNI::Set containing <PNI::Scenario>s.
$sub_scenario = $scenario->add_scenario;
use PNI::Scenario; my $scenario = PNI::Scenario::by_id($scenario_id);
Given a scenario id, returns a reference to the scenario.
$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.
my $scenario_hashref = $scen->to_hashref;
Returns an hash ref representing the scenario.
To install PNI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PNI
CPAN shell
perl -MCPAN -e shell install PNI
For more information on module installation, please visit the detailed CPAN module installation guide.