TEST2::COMPARE::REF(3pm)

πŸ’… NAME πŸ’…

ok so this is Test2::Compare::Ref(3pm) β€” your girl from the Perl Programmers Reference Guide β€” and she does exactly one thing and she does it iconically: ref comparison. literally just comparing refs. that's the whole vibe. πŸ’–


✨ DESCRIPTION ✨

so basically, Test2::Compare::Ref gets used to compare two refs when you're doing a deep comparison. that's it. that's the job. she shows up, she checks the refs are the same actual ref, she leaves. no cap. 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

ok bestie here's the whole thing, verbatim, because I would never do you dirty:

my $ref = {};
my $check = Test2::Compare::Ref->new(input => $ref);

# Passes
is( [$ref], [$check], "The array contains the exact ref we want" );

# Fails, they both may be empty hashes, but we are looking for a specific
# reference.
is( [{}], [$check], "This will fail");

so the first is() passes because like… the array literally contains the exact ref we want πŸ’– the second one fails, and the reason is such a mood: yes, they both may be empty hashes, but we're out here looking for a specific reference, not just any cute empty hash that wanders by. she's not fooled. periodt. 😭

ngl the second example is the whole point of the class β€” same-looking is not the same ref, and this check knows the difference.

πŸ”₯ SOURCE πŸ”₯

you want the source code repository for Test2-Suite? it's right here, go off:

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


πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org> πŸ’œ

🌸 AUTHORS 🌸

  • Chad Granum <exodist@cpan.org> πŸ’œ

(yes bestie, same person β€” he's carrying this whole thing on his back, main character energy fr fr 🌈)


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/


ok that's the page!! πŸŽ€ tiny page, big energy. this is Test2::Compare::Ref(3pm) from the Perl Programmers Reference Guide, shipped as perl v5.42.3 and dated 2026-11-03 β€” love that for us, now go compare some refs bestie πŸ’…πŸ’–πŸ¦‹

πŸ“¦ where this page comes from