Test2::...egatable(3)

πŸ“¦ version 1.302214, in opensuse-leap 16.0

okay so bestie, welcome to the Test2::Compare::Negatable page β€” you might see it tagged as Test2::...egatable(3) in the User Contributed Perl Documentation, and we are so here for it ✨

🌸 NAME 🌸

Test2::Compare::Negatable β€” literally β€œPoor mans 'role' for compare objects that can be negated.” πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

Using this package inside a Test2::Compare::Base subclass will overload "!$obj" and import clone_negate() and toggle_negate(). no cap, 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.

it's giving β€œold perl said no inheritance for this vibe, so we emulated it per class,” and honestly? iconic problem-solving πŸ”₯

πŸŽ€ ATTRIBUTES πŸŽ€

  • $bool = $obj->negate β€” the negate accessor signature, right here bestie πŸ’–
  • $obj->set_negate($bool) β€” the setter signature for that same negate bool ✨
  • $attr = NEGATE() β€” the NEGATE attribute will be added via Test2::Util::HashBase. periodt 🧚

πŸ‘‘ METHODS πŸ‘‘

  • $clone = $obj->clone_negate() β€” Create a shallow copy of the object, and call "toggle_negate" on it. shallow copy slay, but it's a shallow copy, okay? πŸ’…
  • $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 main character energy πŸ”

🌈 SOURCE 🌈

The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/. go off, repo 🫢

πŸ’œ MAINTAINERS πŸ’œ

Chad Granum <exodist@cpan.org>

⭐ AUTHORS ⭐

Chad Granum <exodist@cpan.org>

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/


that's the whole page, bestie πŸ’– cute little sign-off: perl v5.42.0, 2025-07-28, and the page tag Test2::...egatable(3) β€” mwah πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from