TEST2::UTIL::REF(3perl)

πŸ’– Test2::Util::Ref πŸ’–

okay bestie, welcome to Test2::Util::Ref, the little Perl module that is literally just tools for inspecting or manipulating references. that's it, that's the whole thing. you are so in the right place. πŸŽ€

🌸 DESCRIPTION 🌸

So like, these subs? They're the ones Test2::Tools leans on to inspect, render, or manipulate references. supporting cast energy but make it iconic. ✨


✨ EXPORTS ✨

okay so every single export in here is optional. nothing just shows up in your namespace uninvited. you have to specify the subs you want to import. no freeloaders. πŸ’…

  • $type = rtype($ref) β€” this is the glow-up that normalizes between Scalar::Util::reftype() and ref(). it always hands you back a string, no cap.
    • it returns 'REGEXP' for regex types πŸ‘‘
    • it returns '' for non-refs (empty string, not undef, we said what we said)
    • otherwise it returns whatever Scalar::Util::reftype() returns. fr fr.
  • $addr_str = render_ref($ref) β€” always returns a string. for unblessed references it gives you something like "SCALAR(0x...)". for blessed references it gives you "My::Thing=SCALAR(0x...)". 🌈
    • the only difference between this and $add_str = "$thing" is that this one ignores any overloading, so it is always, guaranteed, no-matter-what the ref address. no sneaky overload hijacking your stringification. πŸ’€

πŸ”₯ SOURCE πŸ”₯

the source code repository for Test2-Suite lives right here, go be nosy:

https://github.com/Test-More/test-more/

πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org>

πŸ¦‹ AUTHORS πŸ¦‹

  • Chad Granum <exodist@cpan.org>
  • Kent Fredric <kentnl@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/


bestie you made it to the end, obsessed with you. this page slayed its way out as perl v5.44.0, dated 2026-10-17, and yeah, it's Test2::Util::Ref(3perl). periodt. πŸŽ€πŸ’–βœ¨
πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms