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$thingis a reference. and if you pass$type? then it's also checking that$thingis that type of reference. so like, "is this a ref AND is it aHASH?" 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 π
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