Devel::Calltree - Create a report on which function/method called which.
perl -M"Devel::Calltree %OPTIONS" -e '<SCRIPT>' perl -M"Devel::Calltree %OPTIONS" script.pl perl -MDevel::Calltree -MModule::To::Inspect -e1 # preferably you should be using the supplied script calltree [ OPTIONS ] -e '<SCRIPT>' calltree [ OPTIONS ] script.pl calltree [ OPTIONS ] -MModule::To::Inspect -e1
Report who called whom.
This module inspects the OP-tree of a program or module after compilation is done and creates a report showing which method and function has been called by whom.
Most of the time you want to use the calltree utility instead.
This module is not as useful as it could be with respect to method-calls. While the real package a called function resides in can be figured out in 99% of the cases, this is not true for methods. Method dispatch happens at runtime and therefore, there is no chance to find out whether 'Foo::method' or 'Bar::method' has been called in a case such as
$obj->method; # $obj either a 'Foo' or 'Bar' instance
Currently, it only reports the name of the method that has been called. If the method has no proper name as in
$obj->$method;
nothing is reported. This case is simply not detected.
Despite the above, handling of methods could be improved. Information deducible from the OP-tree include:
Class->method; # even resolving inheritence when @ISA is known at CHECK-time $lexical->method; $PKG::VAR->method; $obj->method1->method2; func()->method;
Assume many. Almost everything in this module is fragile at the moment.
calltree
Also see the original posting to comp.lang.perl.misc that resulted in this module at <http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&selm=buuc15%24o3f%241%40plover.com>.
Original idea and code by Mark Jason Dominus <mjd@plover.com>.
Current maintainer Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de>.
Original code copyright (C) 2003 Mark Jason Dominus
Revisions copyright (C) 2004 by Tassilo von Parseval
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Copyright (C) 2004 by Tassilo von Parseval
To install Devel::Calltree, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::Calltree
CPAN shell
perl -MCPAN -e shell install Devel::Calltree
For more information on module installation, please visit the detailed CPAN module installation guide.