Sub::Ha...ry::Bool(3)

✨ NAME ✨

okay so bestie, this is Sub::HandlesVia::HandlerLibrary::Bool β€” the whole thing lives in the User Contributed Perl Documentation section of the manual (section 3, for all my fellow "read the docs" girlies πŸ’…). it's the library of bool-related methods for Sub::HandlesVia. that's it. that's the vibe. tiny but mighty. πŸŽ€


🌸 SYNOPSIS 🌸

here's how you'd actually use it, no cap:

package My::Class {
  use Moo;
  use Sub::HandlesVia;
  use Types::Standard 'Bool';
  has attr => (
    is => 'rwp',
    isa => Bool,
    handles_via => 'Bool',
    handles => {
      'my_not' => 'not',
      'my_reset' => 'reset',
      'my_set' => 'set',
      'my_toggle' => 'toggle',
      'my_unset' => 'unset',
    },
  );
}

look at that. five lil methods, all handcrafted for your boolean. the way that handles_via => 'Bool' just ✨ does it ✨.


πŸ¦‹ DESCRIPTION πŸ¦‹

This is a library of methods for Sub::HandlesVia. that's the whole description. short and sweet, main character energy, no filler. πŸ’œ


πŸ‘‘ DELEGATABLE METHODS πŸ‘‘

these are the methods you get to hand off to your boolean attribute. delegate away, bestie, it's giving efficiency.

🌈 not()

Returns the opposite value of the boolean. literally just flips it. iconic.

my $object = My::Class->new( attr => 1 );
say $object->my_not(); ## ==> false

πŸŽ€ reset()

Sets the boolean to its default value, or false if it has no default. so like, if you never gave it a default, it's not gonna invent one. it goes to false. periodt.

⭐ set()

Sets the value of the boolean to true. yes. just true. slay.

my $object = My::Class->new();
$object->my_set();
say $object->attr; ## ==> true

πŸ”₯ toggle()

Toggles the truth value of the boolean. true becomes false, false becomes true, chaos becomes order, order becomes chaos, etc. etc. πŸ¦‹

my $object = My::Class->new();
$object->my_toggle();
say $object->attr; ## ==> true
$object->my_toggle();
say $object->attr; ## ==> false

see? flip, flip. obsessed.

πŸ“ unset()

Sets the value of the boolean to false. the yin to set()'s yang. πŸ’œ

my $object = My::Class->new();
$object->my_unset();
say $object->attr; ## ==> false

πŸ’€ BUGS πŸ’€

found a bug? bestie, please report any bugs to <https://github.com/tobyink/p5-sub-handlesvia/issues>. the maintainer will thank you, fr fr. πŸ™ˆ


🌟 SEE ALSO 🌟

  • Sub::HandlesVia. that's the big one. go read it. iykyk.

πŸ’– AUTHOR πŸ’–

Toby Inkster <tobyink@cpan.org>. an absolute legend. πŸ‘‘


This software is copyright (c) 2020, 2022 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like, go wild, but read the terms. πŸ’…


🌸 DISCLAIMER OF WARRANTIES 🌸

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

like… no warranty. none. zero. don't come for her if it breaks. 😭


and that's the whole page, bestie!! this one's from perl v5.42.0, dated 2026-02-11 πŸŽ€ β€” and you were reading Sub::Ha...ry::Bool(3), the bool handler library of Sub::HandlesVia. go forth and toggle. βœ¨πŸ’œπŸŒˆ

πŸ“¦ where this page comes from