1Devel::Symdump(3)     User Contributed Perl Documentation    Devel::Symdump(3)
2
3
4

NAME

6       Devel::Symdump - dump symbol names or the symbol table
7

SYNOPSIS

9           # Constructor
10           require Devel::Symdump;
11           @packs = qw(some_package another_package);
12           $obj = Devel::Symdump->new(@packs);        # no recursion
13           $obj = Devel::Symdump->rnew(@packs);       # with recursion
14
15           # Methods
16           @array = $obj->packages;
17           @array = $obj->scalars;
18           @array = $obj->arrays;
19           @array = $obj->hashes;
20           @array = $obj->functions;
21           @array = $obj->filehandles;  # deprecated, use ios instead
22           @array = $obj->dirhandles;   # deprecated, use ios instead
23           @array = $obj->ios;
24           @array = $obj->unknowns;     # only perl version < 5.003 had some
25
26           $string = $obj->as_string;
27           $string = $obj->as_HTML;
28           $string = $obj1->diff($obj2);
29
30           $string = Devel::Symdump->isa_tree;    # or $obj->isa_tree
31           $string = Devel::Symdump->inh_tree;    # or $obj->inh_tree
32
33           # Methods with autogenerated objects
34           # all of those call new(@packs) internally
35           @array = Devel::Symdump->packages(@packs);
36           @array = Devel::Symdump->scalars(@packs);
37           @array = Devel::Symdump->arrays(@packs);
38           @array = Devel::Symdump->hashes(@packs);
39           @array = Devel::Symdump->functions(@packs);
40           @array = Devel::Symdump->ios(@packs);
41           @array = Devel::Symdump->unknowns(@packs);
42

DESCRIPTION

44       This little package serves to access the symbol table of perl.
45
46       "Devel::Symdump->rnew(@packages)"
47           returns a symbol table object for all subtrees below @packages.
48           Nested Modules are analyzed recursively. If no package is given as
49           argument, it defaults to "main". That means to get the whole symbol
50           table, just do a "rnew" without arguments.
51
52           The global variable $Devel::Symdump::MAX_RECURSION limits the
53           recursion to prevent contention. The default value is set to 97,
54           just low enough to survive the test suite without a warning about
55           deep recursion.
56
57       "Devel::Symdump->new(@packages)"
58           does not go into recursion and only analyzes the packages that are
59           given as arguments.
60
61       packages, scalars, arrays, hashes, functions, ios
62           The methods packages(), scalars(), arrays(), hashes(), functions(),
63           ios(), and (for older perls) unknowns() each return an array of
64           fully qualified symbols of the specified type in all packages that
65           are held within a Devel::Symdump object, but without the leading
66           "$", "@" or "%". In a scalar context, they will return the number
67           of such symbols. Unknown symbols are usually either formats or
68           variables that haven't yet got a defined value.
69
70           Note that scalar symbol table entries are a special case.  If a
71           symbol table entry exists at all, presence of a scalar is currently
72           unknowable, due to a feature of Perl described in "Making
73           References" in perlref point 7.  For example, this package will
74           mark a scalar value $foo as present if any of @foo, %foo, &foo etc.
75           have been declared or used.
76
77       as_string
78       as_HTML
79           As_string() and as_HTML() return a simple string/HTML
80           representations of the object.
81
82       diff
83           Diff() prints the difference between two Devel::Symdump objects in
84           human readable form. The format is similar to the one used by the
85           as_string method.
86
87       isa_tree
88       inh_tree
89           Isa_tree() and inh_tree() both return a simple string
90           representation of the current inheritance tree. The difference
91           between the two methods is the direction from which the tree is
92           viewed: top-down or bottom-up. As I'm sure, many users will have
93           different expectation about what is top and what is bottom, I'll
94           provide an example what happens when the Socket module is loaded:
95
96       % print Devel::Symdump->inh_tree
97               AutoLoader
98                       DynaLoader
99                               Socket
100               DynaLoader
101                       Socket
102               Exporter
103                       Carp
104                       Config
105                       Socket
106
107           The inh_tree method shows on the left hand side a package name and
108           indented to the right the packages that use the former.
109
110       % print Devel::Symdump->isa_tree
111               Carp
112                       Exporter
113               Config
114                       Exporter
115               DynaLoader
116                       AutoLoader
117               Socket
118                       Exporter
119                       DynaLoader
120                               AutoLoader
121
122           The isa_tree method displays from left to right ISA relationships,
123           so Socket IS A DynaLoader and DynaLoader IS A AutoLoader.
124           (Actually, they were at the time this manpage was written)
125
126       You may call both methods, isa_tree() and inh_tree(), with an object.
127       If you do that, the object will store the output and retrieve it when
128       you call the same method again later. The typical usage would be to use
129       them as class methods directly though.
130

SUBCLASSING

132       The design of this package is intentionally primitive and allows it to
133       be subclassed easily. An example of a (maybe) useful subclass is
134       Devel::Symdump::Export, a package which exports all methods of the
135       Devel::Symdump package and turns them into functions.
136

SEE ALSO

138       Routines for manipulating stashes: "Package::Stash"; to work with
139       lexicals: "PadWalker".
140

AUTHORS

142       Andreas Koenig <andk@cpan.org> and Tom Christiansen <tchrist@perl.com>.
143       Based on the old dumpvar.pl by Larry Wall.
144

COPYRIGHT, LICENSE

146       This module is
147
148       Copyright (c) 1995, 1997, 2000, 2002, 2005, 2006 Andreas Koenig
149       "<andk@cpan.org>".
150
151       All rights reserved.
152
153       This library is free software; you may use, redistribute and/or modify
154       it under the same terms as Perl itself.
155
156
157
158perl v5.32.0                      2020-07-28                 Devel::Symdump(3)
Impressum