Debian Codegraph @

README

raw
1 NAME
2 Devel::Symdump - dump symbol names or the symbol table
3
4 SYNOPSIS
5 # Constructor
6 require Devel::Symdump;
7 @packs = qw(some_package another_package);
8 $obj = Devel::Symdump->new(@packs); # no recursion
9 $obj = Devel::Symdump->rnew(@packs); # with recursion
10
11 # Methods
12 @array = $obj->packages;
13 @array = $obj->scalars;
14 @array = $obj->arrays;
15 @array = $obj->hashes;
16 @array = $obj->functions;
17 @array = $obj->filehandles; # deprecated, use ios instead
18 @array = $obj->dirhandles; # deprecated, use ios instead
19 @array = $obj->ios;
20 @array = $obj->unknowns; # only perl version < 5.003 had some
21
22 $string = $obj->as_string;
23 $string = $obj->as_HTML;
24 $string = $obj1->diff($obj2);
25
26 $string = Devel::Symdump->isa_tree; # or $obj->isa_tree
27 $string = Devel::Symdump->inh_tree; # or $obj->inh_tree
28
29 # Methods with autogenerated objects
30 # all of those call new(@packs) internally
31 @array = Devel::Symdump->packages(@packs);
32 @array = Devel::Symdump->scalars(@packs);
33 @array = Devel::Symdump->arrays(@packs);
34 @array = Devel::Symdump->hashes(@packs);
35 @array = Devel::Symdump->functions(@packs);
36 @array = Devel::Symdump->ios(@packs);
37 @array = Devel::Symdump->unknowns(@packs);
38
39 DESCRIPTION
40 This little package serves to access the symbol table of perl.
41
42 "Devel::Symdump->rnew(@packages)"
43 returns a symbol table object for all subtrees below @packages.
44 Nested Modules are analyzed recursively. If no package is given as
45 argument, it defaults to "main". That means to get the whole symbol
46 table, just do a "rnew" without arguments.
47
48 The global variable $Devel::Symdump::MAX_RECURSION limits the
49 recursion to prevent contention. The default value is set to 97,
50 just low enough to survive the test suite without a warning about
51 deep recursion.
52
53 "Devel::Symdump->new(@packages)"
54 does not go into recursion and only analyzes the packages that are
55 given as arguments.
56
57 packages, scalars, arrays, hashes, functions, ios
58 The methods packages(), scalars(), arrays(), hashes(), functions(),
59 ios(), and (for older perls) unknowns() each return an array of
60 fully qualified symbols of the specified type in all packages that
61 are held within a Devel::Symdump object, but without the leading
62 "$", "@" or "%". In a scalar context, they will return the number of
63 such symbols. Unknown symbols are usually either formats or
64 variables that haven't yet got a defined value.
65
66 Note that scalar symbol table entries are a special case. If a
67 symbol table entry exists at all, presence of a scalar is currently
68 unknowable, due to a feature of Perl described in "Making
69 References" in perlref point 7. For example, this package will mark
70 a scalar value $foo as present if any of @foo, %foo, &foo etc. have
71 been declared or used.
72
73 as_string
74 as_HTML
75 As_string() and as_HTML() return a simple string/HTML
76 representations of the object.
77
78 diff
79 Diff() prints the difference between two Devel::Symdump objects in
80 human readable form. The format is similar to the one used by the
81 as_string method.
82
83 isa_tree
84 inh_tree
85 Isa_tree() and inh_tree() both return a simple string representation
86 of the current inheritance tree. The difference between the two
87 methods is the direction from which the tree is viewed: top-down or
88 bottom-up. As I'm sure, many users will have different expectation
89 about what is top and what is bottom, I'll provide an example what
90 happens when the Socket module is loaded:
91
92 % print Devel::Symdump->inh_tree
93 AutoLoader
94 DynaLoader
95 Socket
96 DynaLoader
97 Socket
98 Exporter
99 Carp
100 Config
101 Socket
102
103 The inh_tree method shows on the left hand side a package name and
104 indented to the right the packages that use the former.
105
106 % print Devel::Symdump->isa_tree
107 Carp
108 Exporter
109 Config
110 Exporter
111 DynaLoader
112 AutoLoader
113 Socket
114 Exporter
115 DynaLoader
116 AutoLoader
117
118 The isa_tree method displays from left to right ISA relationships,
119 so Socket IS A DynaLoader and DynaLoader IS A AutoLoader. (Actually,
120 they were at the time this manpage was written)
121
122 You may call both methods, isa_tree() and inh_tree(), with an object. If
123 you do that, the object will store the output and retrieve it when you
124 call the same method again later. The typical usage would be to use them
125 as class methods directly though.
126
127 SUBCLASSING
128 The design of this package is intentionally primitive and allows it to
129 be subclassed easily. An example of a (maybe) useful subclass is
130 Devel::Symdump::Export, a package which exports all methods of the
131 Devel::Symdump package and turns them into functions.
132
133 SEE ALSO
134 Routines for manipulating stashes: "Package::Stash"; to work with
135 lexicals: "PadWalker".
136
137 AUTHORS
138 Andreas Koenig <[email protected]> and Tom Christiansen <[email protected]>.
139 Based on the old dumpvar.pl by Larry Wall.
140
141 COPYRIGHT, LICENSE
142 This module is
143
144 Copyright (c) 1995, 1997, 2000, 2002, 2005, 2006 Andreas Koenig
145 "<[email protected]>".
146
147 All rights reserved.
148
149 This library is free software; you may use, redistribute and/or modify
150 it under the same terms as Perl itself.
151