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. π
π«Ά COPYRIGHT AND LICENCE π«Ά
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
- fedora 44: perl-Sub-HandlesVia 0.053005-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms