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

VERSION

10       version 2.2201
11

SYNOPSIS

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

DESCRIPTION

36       This trait provides native delegation methods for boolean values. A
37       boolean is a scalar which can be 1, 0, "", or "undef".
38

DEFAULT TYPE

40       If you don't provide an "isa" value for your attribute, it will default
41       to "Bool".
42

PROVIDED METHODS

44       None of these methods accept arguments.
45
46set
47
48           Sets the value to 1 and returns 1.
49
50unset
51
52           Set the value to 0 and returns 0.
53
54toggle
55
56           Toggles the value. If it's true, set to false, and vice versa.
57
58           Returns the new value.
59
60not
61
62           Equivalent of 'not $value'.
63

BUGS

65       See "BUGS" in Moose for details on reporting bugs.
66

AUTHORS

68       •   Stevan Little <stevan@cpan.org>
69
70       •   Dave Rolsky <autarch@urth.org>
71
72       •   Jesse Luehrs <doy@cpan.org>
73
74       •   Shawn M Moore <sartak@cpan.org>
75
76       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
77
78       •   Karen Etheridge <ether@cpan.org>
79
80       •   Florian Ragwitz <rafl@debian.org>
81
82       •   Hans Dieter Pearcey <hdp@cpan.org>
83
84       •   Chris Prather <chris@prather.org>
85
86       •   Matt S Trout <mstrout@cpan.org>
87
89       This software is copyright (c) 2006 by Infinity Interactive, Inc.
90
91       This is free software; you can redistribute it and/or modify it under
92       the same terms as the Perl 5 programming language system itself.
93
94
95
96perl v5.34.0                    Mo2o0s2e2:-:0M1e-t2a1::Attribute::Native::Trait::Bool(3)
Impressum