1B::Xref(3pm)           Perl Programmers Reference Guide           B::Xref(3pm)
2
3
4

NAME

6       B::Xref - Generates cross reference reports for Perl programs
7

SYNOPSIS

9       perl -MO=Xref[,OPTIONS] foo.pl
10

DESCRIPTION

12       The B::Xref module is used to generate a cross reference listing of all
13       definitions and uses of variables, subroutines and formats in a Perl
14       program.  It is implemented as a backend for the Perl compiler.
15
16       The report generated is in the following format:
17
18           File filename1
19             Subroutine subname1
20               Package package1
21                 object1        line numbers
22                 object2        line numbers
23                 ...
24               Package package2
25               ...
26
27       Each File section reports on a single file. Each Subroutine section
28       reports on a single subroutine apart from the special cases
29       "(definitions)" and "(main)". These report, respectively, on subroutine
30       definitions found by the initial symbol table walk and on the main part
31       of the program or module external to all subroutines.
32
33       The report is then grouped by the Package of each variable, subroutine
34       or format with the special case "(lexicals)" meaning lexical variables.
35       Each object name (implicitly qualified by its containing Package)
36       includes its type character(s) at the beginning where possible. Lexical
37       variables are easier to track and even included dereferencing
38       information where possible.
39
40       The "line numbers" are a comma separated list of line numbers (some
41       preceded by code letters) where that object is used in some way.
42       Simple uses aren't preceded by a code letter. Introductions (such as
43       where a lexical is first defined with "my") are indicated with the
44       letter "i". Subroutine and method calls are indicated by the character
45       "&".  Subroutine definitions are indicated by "s" and format
46       definitions by "f".
47

OPTIONS

49       Option words are separated by commas (not whitespace) and follow the
50       usual conventions of compiler backend options.
51
52       "-oFILENAME"
53               Directs output to "FILENAME" instead of standard output.
54
55       "-r"    Raw output. Instead of producing a human-readable report,
56               outputs a line in machine-readable form for each definition/use
57               of a variable/sub/format.
58
59       "-d"    Don't output the "(definitions)" sections.
60
61       "-D[tO]"
62               (Internal) debug options, probably only useful if "-r"
63               included.  The "t" option prints the object on the top of the
64               stack as it's being tracked. The "O" option prints each
65               operator as it's being processed in the execution order of the
66               program.
67

BUGS

69       Non-lexical variables are quite difficult to track through a program.
70       Sometimes the type of a non-lexical variable's use is impossible to
71       determine. Introductions of non-lexical non-scalars don't seem to be
72       reported properly.
73

AUTHOR

75       Malcolm Beattie, mbeattie@sable.ox.ac.uk.
76
77
78
79perl v5.12.4                      2011-06-01                      B::Xref(3pm)
Impressum