1Moose::Meta::Attribute:U:sNeartiCvoen:t:rTiMrboauoitstee:d:::BPMoeeortlla(:3D:)oActutmreinbtuattei:o:nNative::Trait::Bool(3)
2
3
4

NAME

6       Moose::Meta::Attribute::Native::Trait::Bool - Helper trait for Bool
7       attributes
8

SYNOPSIS

10         package Room;
11         use Moose;
12
13         has 'is_lit' => (
14             traits    => ['Bool'],
15             is        => 'rw',
16             isa       => 'Bool',
17             default   => 0,
18             handles   => {
19                 illuminate  => 'set',
20                 darken      => 'unset',
21                 flip_switch => 'toggle',
22                 is_dark     => 'not',
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

PROVIDED METHODS

37       These methods are implemented in
38       Moose::Meta::Attribute::Native::MethodProvider::Bool. It is important
39       to note that all those methods do in place modification of the value
40       stored in the attribute.
41
42       set Sets the value to 1.
43
44       unset
45           Set the value to 0.
46
47       toggle
48           Toggles the value. If it's true, set to false, and vice versa.
49
50       not Equivalent of 'not $value'.
51

METHODS

53       meta
54       has_method_provider
55       method_provider
56

BUGS

58       See "BUGS" in Moose for details on reporting bugs.
59

AUTHOR

61       Jason May
62
64       Copyright 2007-2009 by Infinity Interactive, Inc.
65
66       <http://www.iinteractive.com>
67
68       This library is free software; you can redistribute it and/or modify it
69       under the same terms as Perl itself.
70
71
72
73perl v5.12.2                    Mo2o0s1e0:-:0M8e-t2a8::Attribute::Native::Trait::Bool(3)
Impressum