Devel::MAT::Graph - a set of references between related SVs
Devel::MAT::Graph
Instances of this class represent an entire graph of references between related SVs, as a helper method for return values from various Devel::MAT methods, which might be used for some sort of screen layout or other analysis tasks.
$graph = Devel::MAT::Graph->new( $dumpfile )
Constructs a new Devel::MAT::Graph instance backed by the given dumpfile (which is only actually used to make the $node->sv method work).
$node->sv
$graph->add_sv( $sv )
Makes the graph aware of the given Devel::MAT::SV. This is not strictly necessary before calling add_ref or add_root, but ensures that has_sv will return true immediately after it, and so can be used as a sentinel for recursion control.
add_ref
add_root
has_sv
$graph->add_ref( $from_sv, $to_sv, $desc )
Adds an edge to the graph, from and to the given SVs, with the given description.
$graph->add_root( $from_sv, $desc )
Adds a root edge to the graph, at the given SV with the given description.
$bool = $graph->has_sv( $sv )
Returns true if the graph has edges or roots for the given SV, or it has at least been given to add_sv.
add_sv
$node = $graph->get_sv_node( $sv )
Returns a Node object for the given SV.
Node
@desc_nodes = $graph->get_root_nodes
Returns an even-sized list of pairs, containing root descriptions and the nodes having those roots, in no particular order.
The values returned by get_sv_node respond to the following methods:
get_sv_node
$graph = $node->graph
Returns the containing Devel::MAT::Graph instance.
$addr = $node->addr
Returns the address of the SV represented by this node.
$sv = $node->sv
Returns the SV object itself, as taken from the dumpfile instance.
@roots = $node->roots
Returns any root descriptions given (by calls to $graph->add_root for the SV at this node.
$graph->add_root
$graph->add_root( $sv, $desc ); ( $desc, ... ) = $graph->get_sv_node( $sv )->roots
@edges = $node->edges_out
Returns an even-sized list of any edge descriptions and more Node objects given as references (by calls to $graph->add_ref) from the SV at this node.
$graph->add_ref
$graph->add_ref( $from_sv, $to_sv, $desc ) ( $desc, $to_edge, ... ) = $graph->get_sv_node( $from_sv )->edges_out
$n_edges = $node->edges_out
In scalar context, returns the number of edges that exist; i.e. half the size of the pairlist that would be returned in list context.
@edges = $node->edges_in
Similar to edges_out, but returns edges in the opposite direction; i.e. edges of references to this node.
edges_out
$graph->add_ref( $from_sv, $to_sv, $desc ) ( $desc, $from_edge, ... ) = $graph->get_sv_node( $to_sv )->edges_in
Paul Evans <leonerd@leonerd.org.uk>
To install Devel::MAT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::MAT
CPAN shell
perl -MCPAN -e shell install Devel::MAT
For more information on module installation, please visit the detailed CPAN module installation guide.