logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Sub::HandlesVia::HandlerLibrary::Bool - library of bool-related methods

Author

       Toby Inkster <tobyink@cpan.org>.

Bugs

       Please report any bugs to <https://github.com/tobyink/p5-sub-handlesvia/issues>.

Delegatable Methods

not()
       Returns the opposite value of the boolean.

         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.

   set()
       Sets the value of the boolean to true.

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

   toggle()
       Toggles the truth value of the boolean.

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

   unset()
       Sets the value of the boolean to false.

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

Description

       This is a library of methods for Sub::HandlesVia.

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.

perl v5.40.1                                       2025-04-01              Sub::HandlesVi...erLibrary::Bool(3pm)

Name

       Sub::HandlesVia::HandlerLibrary::Bool - library of bool-related methods

See Also

       Sub::HandlesVia.

Synopsis

         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',
             },
           );
         }

See Also