1MooseX::AttributeHelperUss:e:rTrCaointt:r:iBbouotleM(do3opPsmee)rXl::DAotcturmiebnuttaetHieolnpers::Trait::Bool(3pm)
2
3
4
6 MooseX::AttributeHelpers::Trait::Bool
7
9 version 0.25
10
12 package Room;
13 use Moose;
14 use MooseX::AttributeHelpers;
15
16 has 'is_lit' => (
17 metaclass => 'Bool',
18 is => 'rw',
19 isa => 'Bool',
20 default => sub { 0 },
21 provides => {
22 set => 'illuminate',
23 unset => 'darken',
24 toggle => 'flip_switch',
25 not => 'is_dark'
26 }
27 );
28
29 my $room = Room->new();
30 $room->illuminate; # same as $room->is_lit(1);
31 $room->darken; # same as $room->is_lit(0);
32 $room->flip_switch; # same as $room->is_lit(not $room->is_lit);
33 return $room->is_dark; # same as !$room->is_lit
34
36 This provides a simple boolean attribute, which supports most of the
37 basic math operations.
38
40 meta
41 helper_type
42 method_constructors
43 has_method_provider
44 method_provider
45
47 It is important to note that all those methods do in place modification
48 of the value stored in the attribute.
49
50 set Sets the value to 1.
51
52 unset
53 Set the value to 0.
54
55 toggle
56 Toggle the value. If it's true, set to false, and vice versa.
57
58 not Equivalent of 'not $value'.
59
61 Bugs may be submitted through the RT bug tracker
62 <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-
63 AttributeHelpers> (or bug-MooseX-AttributeHelpers@rt.cpan.org
64 <mailto:bug-MooseX-AttributeHelpers@rt.cpan.org>).
65
66 There is also a mailing list available for users of this distribution,
67 at <http://lists.perl.org/list/moose.html>.
68
69 There is also an irc channel available for users of this distribution,
70 at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
71
73 Stevan Little <stevan@iinteractive.com>
74
75 Jason May
76
78 This software is copyright (c) 2007 by Stevan Little and Infinity
79 Interactive, Inc.
80
81 This is free software; you can redistribute it and/or modify it under
82 the same terms as the Perl 5 programming language system itself.
83
84
85
86perl v5.32.0 202M0o-o0s7e-X2:8:AttributeHelpers::Trait::Bool(3pm)