CallGraph::Node - represent a subroutine as a node in a call graph
my $sub1 = CallGraph::Node->new(name => 'main', type => 'internal'); my $sub2 = CallGraph::Node->new(name => 'mysub', type => 'external'); $sub1->add_call($sub2); print $sub1->dump; my @calls = $sub1->calls; my @callers = $sub2->callers; print $sub1->name; # prints 'main' print $sub1->type; # prints 'internal'
This module creates a node within a "call graph" for a program. A node corresponds to a subroutine (or function, method, or whatever it's called), and it has the properties 'name' and 'type'. Subroutines are linked to one another by 'calls'.
Creates a new node. The available options are 'name' and 'type'. These properties really don't mean anything as far as CallGraph::Node is concerned. However, CallGraph expects the name to be unique within a graph, and uses the values 'internal' or 'external'.
Add a link implying that $sub calls $sub2.
Return a list of calls made by $sub. The items in the list are CallGraph::Node items themselves.
Return a list of calls received by $sub. The items in the list are CallGraph::Node items themselves.
Get or set the name of the subroutine.
Get or set the type of the subroutine.
Dump the call graph, starting from $sub, into a string representation. The options are passed to CallGraph::Dumper.
0.55
CallGraph, CallGraph::Dumper, CallGraph::Lang::Fortran
Ivan Tubert <itub@cpan.org>
Copyright (c) 2004 Ivan Tubert. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CallGraph, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CallGraph
CPAN shell
perl -MCPAN -e shell install CallGraph
For more information on module installation, please visit the detailed CPAN module installation guide.