The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Devel::Calltree - Create a report on which function/method called which.

SYNOPSIS

    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

ABSTRACT

    Report who called whom.
    

DESCRIPTION

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.

LIMITATIONS

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.

TODO

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;

BUGS

Assume many. Almost everything in this module is fragile at the moment.

SEE ALSO

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>.

AUTHOR

Original idea and code by Mark Jason Dominus <mjd@plover.com>.

Current maintainer Tassilo von Parseval <tassilo.parseval@post.rwth-aachen.de>.

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Tassilo von Parseval

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.