1Sub::HandlesVia::HandleUrsLeirbrCaornyt:r:iBbouotle(d3S)Puebr:l:HDaoncdulmeesnVtiaat:i:oHnandlerLibrary::Bool(3)
2
3
4

NAME

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

SYNOPSIS

9         package My::Class {
10           use Moo;
11           use Sub::HandlesVia;
12           use Types::Standard 'Bool';
13           has attr => (
14             is => 'rwp',
15             isa => Bool,
16             handles_via => 'Bool',
17             handles => {
18               'my_not' => 'not',
19               'my_reset' => 'reset',
20               'my_set' => 'set',
21               'my_toggle' => 'toggle',
22               'my_unset' => 'unset',
23             },
24           );
25         }
26

DESCRIPTION

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

DELEGATABLE METHODS

31   not()
32       Returns the opposite value of the boolean.
33
34         my $object = My::Class->new( attr => 1 );
35         say $object->my_not(); ## ==> false
36
37   reset()
38       Sets the boolean to its default value, or false if it has no default.
39
40   set()
41       Sets the value of the boolean to true.
42
43         my $object = My::Class->new();
44         $object->my_set();
45         say $object->attr; ## ==> true
46
47   toggle()
48       Toggles the truth value of the boolean.
49
50         my $object = My::Class->new();
51         $object->my_toggle();
52         say $object->attr; ## ==> true
53         $object->my_toggle();
54         say $object->attr; ## ==> false
55
56   unset()
57       Sets the value of the boolean to false.
58
59         my $object = My::Class->new();
60         $object->my_unset();
61         say $object->attr; ## ==> false
62

BUGS

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

SEE ALSO

68       Sub::HandlesVia.
69

AUTHOR

71       Toby Inkster <tobyink@cpan.org>.
72
74       This software is copyright (c) 2020, 2022 by Toby Inkster.
75
76       This is free software; you can redistribute it and/or modify it under
77       the same terms as the Perl 5 programming language system itself.
78

DISCLAIMER OF WARRANTIES

80       THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
81       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
82       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
83
84
85
86perl v5.36.0                      2023-S0u4b-:0:6HandlesVia::HandlerLibrary::Bool(3)
Impressum