Test2::Tools::Ref(3)

πŸ“¦ version 1.302214, in opensuse-leap 16.0

πŸ’… Test2::Tools::Ref

okay so bestie, this is a page from the Test2::Tools::Ref manual (it's Perl module documentation, iykyk) ✨ β€” and it's literally all about checking that stuff is actually a reference, no cap. Like, is it a ref? Is it a specific kind of ref? Are these two refs the exact same ref or not? That's the whole vibe. None of the functions here do deep comparisons, periodt.


✨ DESCRIPTION ✨

So this module is just a little collection of tools that let you verify something is a ref. It also has tools to check if two refs are the same exact ref, or different refs. And hear me clearly: none of the functions in this module do deep comparisons. Not one. Zero. Don't come for them about it πŸ’…


🌸 SYNOPSIS 🌸

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");

Like, look at it go. Iconic behavior honestly πŸŽ€


πŸ¦‹ EXPORTS πŸ¦‹

All subs are exported by default β€” every single one, no extra steps required, we love a generous module 🫢

✨ ref_ok($thing) / ref_ok($thing, $type) / ref_ok($thing, $type, $name)

This one checks that $thing is a reference. And if you pass in $type, it'll also check that $thing is that type of reference. So like, ref_ok($ref, 'HASH') is you being like "bestie this better be a hash ref" and the module is like "say less." πŸ’– (All three signatures β€” ref_ok($thing), ref_ok($thing, $type), ref_ok($thing, $type, $name) β€” are listed, so pick your fave.)

✨ ref_is($ref1, $ref2, $name)

Verify that two references are the exact same reference. Same ref, same energy, literally the same one. πŸ”₯

✨ ref_is_not($ref1, $ref2, $name)

Verify that two references are not the exact same reference. Different refs, different vibes, do not confuse them πŸ’€


🌈 SOURCE 🌈

The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. Go look, it's right there πŸ‘‘


πŸ‘‘ 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/


πŸ’œ cute sign-off πŸ’œ

so yeah, that's the whole page fr fr. This was perl v5.42.0, dated 2025-07-28, and the page itself is Test2::Tools::Ref(3) β€” go check your refs, bestie, and slay πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from