Test2::Tools::Ref(3pm)
π Test2::Tools::Ref(3pm)
okay so bestie, welcome to Test2::Tools::Ref, straight out of the Perl Programmers Reference Guide. it's a whole little module for checking that your refs are, in fact, refs β and yes, we're gonna go through every single bit of it together π«Ά
β¨ NAME β¨
Test2::Tools::Ref β literally just Tools for validating references. that's the vibe. π
π¦ DESCRIPTION π¦
okay so here's the deal: this module is packed with tools that let you verify that something is a ref. that's the main character energy right there.
it also has tools to check if two refs are the same exact ref, or if they're different. and ngl, this part matters so listen up:
None of the functions in this module do deep comparisons. not a single one. zero. don't come for me when your nested data structure doesn't match the way you wanted it to π
like, surface level only. it's giving "yes i know her" not "let me tell you her whole life story". π
πΈ SYNOPSIS πΈ
here's the whole thing in action, copy-paste ready, exactly as it should look:
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");
(and yes bestie, that second ref_ok line is missing its semicolon in the original. i'm not fixing it, i'm just telling you it's there. character for character, periodt. π
)
π EXPORTS π
All subs are exported by default. no import list needed, they just show up. iconic behavior honestly β¨
ref_ok($thing)ref_ok($thing, $type)ref_ok($thing, $type, $name)β this one checks that$thingis a reference. and if you pass$type, it also checks that$thingis that type of reference. so'HASH'means hash ref or it's a no from me π lowkey the most useful one tbh.ref_is($ref1, $ref2, $name)β verify that two references are the exact same reference. same one. same address. same girl. πref_is_not($ref1, $ref2, $name)β verify that two references are not the exact same reference. different refs, different vibes, no cap π¦
π₯ SOURCE π₯
the source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. go be nosy, i support it π
π 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/
okay that's the whole page, you ate that π and before you go β this gorgeous little number is from perl v5.42.3, dated 2026-11-03, and it's Test2::Tools::Ref(3pm) forever and always. mwah πβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl 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