1Devel::Symdump(3) User Contributed Perl Documentation Devel::Symdump(3)
2
3
4
6 Devel::Symdump - dump symbol names or the symbol table
7
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
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 as_string
71 as_HTML
72 As_string() and as_HTML() return a simple string/HTML
73 representations of the object.
74
75 diff
76 Diff() prints the difference between two Devel::Symdump objects in
77 human readable form. The format is similar to the one used by the
78 as_string method.
79
80 isa_tree
81 inh_tree
82 Isa_tree() and inh_tree() both return a simple string
83 representation of the current inheritance tree. The difference
84 between the two methods is the direction from which the tree is
85 viewed: top-down or bottom-up. As I'm sure, many users will have
86 different expectation about what is top and what is bottom, I'll
87 provide an example what happens when the Socket module is loaded:
88
89 % print Devel::Symdump->inh_tree
90 AutoLoader
91 DynaLoader
92 Socket
93 DynaLoader
94 Socket
95 Exporter
96 Carp
97 Config
98 Socket
99
100 The inh_tree method shows on the left hand side a package name and
101 indented to the right the packages that use the former.
102
103 % print Devel::Symdump->isa_tree
104 Carp
105 Exporter
106 Config
107 Exporter
108 DynaLoader
109 AutoLoader
110 Socket
111 Exporter
112 DynaLoader
113 AutoLoader
114
115 The isa_tree method displays from left to right ISA relationships,
116 so Socket IS A DynaLoader and DynaLoader IS A AutoLoader.
117 (Actually, they were at the time this manpage was written)
118
119 You may call both methods, isa_tree() and inh_tree(), with an object.
120 If you do that, the object will store the output and retrieve it when
121 you call the same method again later. The typical usage would be to use
122 them as class methods directly though.
123
125 The design of this package is intentionally primitive and allows it to
126 be subclassed easily. An example of a (maybe) useful subclass is
127 Devel::Symdump::Export, a package which exports all methods of the
128 Devel::Symdump package and turns them into functions.
129
131 Andreas Koenig <andk@cpan.org> and Tom Christiansen <tchrist@perl.com>.
132 Based on the old dumpvar.pl by Larry Wall.
133
135 This module is
136
137 Copyright (c) 1995, 1997, 2000, 2002, 2005, 2006 Andreas Koenig
138 "<andk@cpan.org>".
139
140 All rights reserved.
141
142 This library is free software; you may use, redistribute and/or modify
143 it under the same terms as Perl itself.
144
145
146
147perl v5.10.1 2007-06-25 Devel::Symdump(3)