2 Devel::Symdump - dump symbol names or the symbol table
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
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
20 @array = $obj->unknowns; # only perl version < 5.003 had some
22 $string = $obj->as_string;
23 $string = $obj->as_HTML;
24 $string = $obj1->diff($obj2);
26 $string = Devel::Symdump->isa_tree; # or $obj->isa_tree
27 $string = Devel::Symdump->inh_tree; # or $obj->inh_tree
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);
40 This little package serves to access the symbol table of perl.
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.
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
53 "Devel::Symdump->new(@packages)"
54 does not go into recursion and only analyzes the packages that are
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.
68 As_string() and as_HTML() return a simple string/HTML
69 representations of the object.
72 Diff() prints the difference between two Devel::Symdump objects in
73 human readable form. The format is similar to the one used by the
78 Isa_tree() and inh_tree() both return a simple string representation
79 of the current inheritance tree. The difference between the two
80 methods is the direction from which the tree is viewed: top-down or
81 bottom-up. As I'm sure, many users will have different expectation
82 about what is top and what is bottom, I'll provide an example what
83 happens when the Socket module is loaded:
85 % print Devel::Symdump->inh_tree
96 The inh_tree method shows on the left hand side a package name and
97 indented to the right the packages that use the former.
99 % print Devel::Symdump->isa_tree
111 The isa_tree method displays from left to right ISA relationships,
112 so Socket IS A DynaLoader and DynaLoader IS A AutoLoader. (Actually,
113 they were at the time this manpage was written)
115 You may call both methods, isa_tree() and inh_tree(), with an object. If
116 you do that, the object will store the output and retrieve it when you
117 call the same method again later. The typical usage would be to use them
118 as class methods directly though.
121 The design of this package is intentionally primitive and allows it to
122 be subclassed easily. An example of a (maybe) useful subclass is
123 Devel::Symdump::Export, a package which exports all methods of the
124 Devel::Symdump package and turns them into functions.
127 Andreas Koenig <andk@cpan.org> and Tom Christiansen <tchrist@perl.com>.
128 Based on the old dumpvar.pl by Larry Wall.
133 Copyright (c) 1995, 1997, 2000, 2002, 2005, 2006 Andreas Koenig
138 This library is free software; you may use, redistribute and/or modify
139 it under the same terms as Perl itself.