TEST2::TOOLS::REF(3perl)

πŸ’– Test2::Tools::Ref β€” the 3perl manual, but make it make sense πŸ’–

okay bestie, you found the Test2::Tools::Ref page and honestly? it's giving "small module, big power." let's get into it 🫢


✨ NAME ✨

Test2::Tools::Ref β€” tools for validating references. that's it, that's the whole vibe. πŸ’…


🌸 DESCRIPTION 🌸

so this module is a little bag of tools that let you verify that something is a ref. it also has tools to check whether two refs are the same exact ref, or not the same exact ref. literally just that.

⚠️ important, no cap: none of the functions in this module do deep comparisons. we're talking surface level, identity-checking energy only. don't come here expecting it to dig through your nested data structure, because it will not. πŸ’€

πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole thing in action, look how cute it is:

use Test2::Tools::Ref;

# Ensure something is a ref.
ref_ok($ref);

# Check that $ref is a HASH reference
ref_ok($ref, 'HASH', 'Must be a hash')

ref_is($refa, $refb, "Same exact reference");

ref_is_not($refa, $refb, "Not the same exact reference");

πŸŽ€ EXPORTS πŸŽ€

All subs are exported by default. every single one, no asking, no :tags, you just get them. iconic behavior honestly. ✨

  • ref_ok($thing)
  • ref_ok($thing, $type)
  • ref_ok($thing, $type, $name) β€” this one checks that $thing is a reference. and if you pass $type? then it's also checking that $thing is that type of reference. so like, "is this a ref AND is it a HASH?" boom, both, one call. πŸ”₯
  • ref_is($ref1, $ref2, $name) β€” verifies that two references are the exact same reference. same ref, same identity, no copies. πŸ‘‘
  • ref_is_not($ref1, $ref2, $name) β€” verifies that two references are not the exact same reference. different refs, different energy, periodt.

πŸ’œ SOURCE πŸ’œ

the source code repository for Test2-Suite lives right here:

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

go poke around, it's open, it's free, it's yours. 🧚


🌈 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/


and that's the whole page, bestie πŸ“

this was perl v5.44.0, dated 2026-10-17 β€” so yeah, go forth, validate those refs, and remember: shallow checks only, no deep dives. mwah πŸ’–βœ¨

πŸ“¦ 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