B::Xref - Generates cross reference reports for Perl programs
perl -MO=Xref[,OPTIONS] foo.pl
The B::Xref module is used to generate a cross reference listing of all definitions and uses of variables, subroutines and formats in a Perl program. It is implemented as a backend for the Perl compiler.
The report generated is in the following format:
File filename1 Subroutine subname1 Package package1 object1 C<line numbers> object2 C<line numbers> ... Package package2 ...
Each File section reports on a single file. Each Subroutine section reports on a single subroutine apart from the special cases ``(definitions)'' and ``(main)''. These report, respectively, on subroutine definitions found by the initial symbol table walk and on the main part of the program or module external to all subroutines.
The report is then grouped by the Package of each variable,
subroutine or format with the special case ``(lexicals)'' meaning
lexical variables. Each object name (implicitly qualified by its
containing Package) includes its type
Option words are separated by commas (not whitespace) and follow the usual conventions of compiler backend options.
Non-lexical variables are quite difficult to track through a program. Sometimes the type of a non-lexical variable's use is impossible to determine. Introductions of non-lexical non-scalars don't seem to be reported properly.
Malcolm Beattie, email@example.com.