NAME

PNI::Node - is a basic unit of code

SYNOPSIS

use PNI;

my $node = PNI::node 'Foo::Bar';


# Or use a scenario.

my $scenario = PNI::root->add_scenario;
my $node = $scenario->add_node( type => 'Foo::Bar' );


# Or do it yourself (:

use PNI::Node;

my $empty_node = PNI::Node->new;

# Decorate node.
my $in = $empty_node->add_input('in');
my $out = $empty_node->add_output('out');

my $node = PNI::Node->new( type => 'Foo::Bar' );
print $node->get_type, "\n"; # prints PNI::Node::Foo::Bar

$node->init;
$node->task;

DESCRIPTION

This is an abstract class: it has an init method called after creation and a task method called at every PNI::task.

ATTRIBUTES

inputs

outputs

ABSTRACT METHODS

init

task

METHODS

add_input

my $input = $node->add_input('name');

my $in = $node->add_input( 'in', data => 'foo' );

Creates a new PNI::Slot::In.

add_output

my $out = $node->add_output('out');

Creates a new PNI::Slot::Out.

get_input

   my $in = $node->get_input('in');

Return an input by the given name.

get_input_edges

get_inputs

get_ordered_inputs

get_ordered_outputs

get_output

my $out = $node->get_output('out');

get_output_edges

get_outputs

get_type

$node->get_type;

Returns the PNI node type, which is the name of the node package minus the leading 'PNI::Node::' string.

has_no_input_slot_changed

sub task{
    my $node = shift;
    return 1 if $node->has_no_input_slot_changed;
    ...
}

parents

my @parent_nodes = $node->parents;

Returns the list of nodes which outputs are connected to node inputs.

c<some_input_slot_is_changed>