1Test2::Util::Stash(3) User Contributed Perl DocumentationTest2::Util::Stash(3)
2
3
4
6 Test2::Util::Stash - Utilities for manipulating stashes and globs.
7
9 This is a collection of utilities for manipulating and inspecting
10 package stashes and globs.
11
13 $stash = get_stash($package)
14 Gets the package stash. This is the same as "$stash =
15 \%Package::Name::".
16
17 $sym_spec = parse_symbol($symbol)
18 $sym_spec = parse_symbol($symbol, $package)
19 Parse a symbol name, and return a hashref with info about the
20 symbol.
21
22 $symbol can be a simple name, or a fully qualified symbol name. The
23 sigil is optional, and "&" is assumed if none is provided. If
24 $symbol is fully qualified, and $package is also provided, then the
25 package of the symbol must match the $package.
26
27 Returns a structure like this:
28
29 return {
30 name => 'BAZ',
31 sigil => '$',
32 type => 'SCALAR',
33 symbol => '&Foo::Bar::BAZ',
34 package => 'Foo::Bar',
35 };
36
37 $glob_ref = get_glob($symbol)
38 $glob_ref = get_glob($symbol, $package)
39 Get a glob ref. Arguments are the same as for "parse_symbol".
40
41 $ref = get_symbol($symbol)
42 $ref = get_symbol($symbol, $package)
43 Get a reference to the symbol. Arguments are the same as for
44 "parse_symbol".
45
46 $ref = purge_symbol($symbol)
47 $ref = purge_symbol($symbol, $package)
48 Completely remove the symbol from the package symbol table.
49 Arguments are the same as for "parse_symbol". A reference to the
50 removed symbol is returned.
51
52 $sig = slot_to_sig($slot)
53 Convert a slot (like 'SCALAR') to a sigil (like '$').
54
55 $slot = sig_to_slot($sig)
56 Convert a sigil (like '$') to a slot (like 'SCALAR').
57
59 The source code repository for Test2-Suite can be found at
60 https://github.com/Test-More/Test2-Suite/.
61
63 Chad Granum <exodist@cpan.org>
64
66 Chad Granum <exodist@cpan.org>
67
69 Copyright 2018 Chad Granum <exodist@cpan.org>.
70
71 This program is free software; you can redistribute it and/or modify it
72 under the same terms as Perl itself.
73
74 See http://dev.perl.org/licenses/
75
76
77
78perl v5.38.0 2023-07-21 Test2::Util::Stash(3)