TEST2::UTIL::STASH(3pm)

πŸ’– NAME πŸ’–

Test2::Util::Stash(3pm) β€” from the Perl Programmers Reference Guide β€” is literally your bestie for manipulating and inspecting package stashes and globs. No cap, it's giving internals with a cute bow on top. πŸŽ€

πŸ¦‹ DESCRIPTION πŸ¦‹

This is a collection of utilities for manipulating and inspecting package stashes and globs. That's the whole vibe: stash stuff, glob stuff, inspect stuff. Slay. ✨

🌸 EXPORTS 🌸

  • $stash = get_stash($package) β€” gets the package stash. This is the same as $stash = \%Package::Name::. Periodt.
  • $sym_spec = parse_symbol($symbol) and $sym_spec = parse_symbol($symbol, $package) β€” parses a symbol name and returns a hashref with info about the symbol.

$symbol can be a simple name, or a fully qualified symbol name. The sigil is optional, and & is assumed if none is provided. If $symbol is fully qualified, and $package is also provided, then the package of the symbol must match the $package.

Returns a structure like this:

return {
    name    => 'BAZ',
    sigil   => '$',
    type    => 'SCALAR',
    symbol  => '&Foo::Bar::BAZ',
    package => 'Foo::Bar',
};
  • $glob_ref = get_glob($symbol) and $glob_ref = get_glob($symbol, $package) β€” gets a glob ref. Arguments are the same as for parse_symbol. Iconic.
  • $ref = get_symbol($symbol) and $ref = get_symbol($symbol, $package) β€” gets a reference to the symbol. Arguments are the same as for parse_symbol. 🫢
  • $ref = purge_symbol($symbol) and $ref = purge_symbol($symbol, $package) β€” completely removes the symbol from the package symbol table. Arguments are the same as for parse_symbol. A reference to the removed symbol is returned. It's giving cleanup era πŸ’…
  • $sig = slot_to_sig($slot) β€” converts a slot (like 'SCALAR') to a sigil (like '$').
  • $slot = sig_to_slot($sig) β€” converts a sigil (like '$') to a slot (like 'SCALAR').

⭐ SOURCE ⭐

The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. Go browse, bestie. πŸ”₯

πŸ‘‘ MAINTAINERS πŸ‘‘

Chad Granum exodist@cpan.org

🌈 AUTHORS 🌈

Chad Granum exodist@cpan.org

Copyright Chad Granum exodist@cpan.org.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/


okay bye bestie πŸ’– this was Test2::Util::Stash(3pm) from perl v5.42.3, dated 2026-11-03, and yes she ate. πŸ’…βœ¨

πŸ“¦ where this page comes from