Test2::Tools::Ref(3)
π 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 π
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
- opensuse-leap 16.0: perl-Test-Simple 1.302214-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms