TEST2::COMPARE::NEGATABLE(3pm)

🌸 NAME

okay so this is Test2::Compare::Negatable(3pm), straight from Perl Programmers Reference Guide. Its whole thing is literally a β€œPoor mans 'role' for compare objects that can be negated.” Bestie, that's the name and the vibe. πŸŽ€

πŸ’– DESCRIPTION

Using this package inside an Test2::Compare::Base subclass will overload !$obj and import clone_negate() and toggle_negate(). That's the whole move. ✨

🧐 WHY?

Until perl 5.18 the 'fallback' parameter to overload would not be inherited, so we cannot use inheritance for the behavior we actually want. This module works around the problem by emulating the "use overload" call we want for each consumer class. No cap, it's a workaround era. πŸ’…

πŸŽ€ ATTRIBUTES

  • $bool = $obj->negate β€” the negate signature, exactly as written.
  • $obj->set_negate($bool) β€” the set_negate($bool) signature, exactly as written.
  • $attr = NEGATE() β€” the NEGATE() signature, exactly as written.

The NEGATE attribute will be added via Test2::Util::HashBase. iykyk ✨

πŸ¦‹ METHODS

  • $clone = $obj->clone_negate() β€” Create a shallow copy of the object, and call "toggle_negate" on it. Shallow copy, bestie β€” not a deep clone. ✨
  • $obj->toggle_negate() β€” Toggle the negate attribute. If the attribute was on it will now be off, if it was off it will now be on. Flip-flop era, literally. πŸ”

🌈 SOURCE

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

πŸ‘‘ MAINTAINERS

Chad Granum <exodist@cpan.org> β€” the maintainer, periodt.

πŸ’œ AUTHORS

Chad Granum <exodist@cpan.org> β€” same icon, author credit.

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 β€” every detail kept, fr fr. This one's from perl v5.42.3, dated 2026-11-03, and it's the Test2::Compare::Negatable(3pm) manual. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from