1MooseX::AttributeHelperUss:e:rTrCaointt:r:iBbouotle(d3M)PoeorsleXD:o:cAutmternitbauttieoHnelpers::Trait::Bool(3)
2
3
4

NAME

6       MooseX::AttributeHelpers::Bool
7

SYNOPSIS

9         package Room;
10         use Moose;
11         use MooseX::AttributeHelpers;
12
13         has 'is_lit' => (
14             metaclass => 'Bool',
15             is        => 'rw',
16             isa       => 'Bool',
17             default   => sub { 0 },
18             provides  => {
19                 set     => 'illuminate',
20                 unset   => 'darken',
21                 toggle  => 'flip_switch',
22                 not     => 'is_dark'
23             }
24         );
25
26         my $room = Room->new();
27         $room->illuminate;     # same as $room->is_lit(1);
28         $room->darken;         # same as $room->is_lit(0);
29         $room->flip_switch;    # same as $room->is_lit(not $room->is_lit);
30         return $room->is_dark; # same as !$room->is_lit
31

DESCRIPTION

33       This provides a simple boolean attribute, which supports most of the
34       basic math operations.
35

METHODS

37       meta
38       helper_type
39       method_constructors
40       has_method_provider
41       method_provider
42

PROVIDED METHODS

44       It is important to note that all those methods do in place modification
45       of the value stored in the attribute.
46
47       set Sets the value to 1.
48
49       unset
50           Set the value to 0.
51
52       toggle
53           Toggle the value. If it's true, set to false, and vice versa.
54
55       not Equivalent of 'not $value'.
56

BUGS

58       All complex software has bugs lurking in it, and this module is no
59       exception. If you find a bug please either email me, or add the bug to
60       cpan-RT.
61

AUTHOR

63       Jason May
64
66       Copyright 2007-2009 by Infinity Interactive, Inc.
67
68       <http://www.iinteractive.com>
69
70       This library is free software; you can redistribute it and/or modify it
71       under the same terms as Perl itself.
72
73
74
75perl v5.12.0                      2010-M0o1o-s0e1X::AttributeHelpers::Trait::Bool(3)
Impressum