MouseX::NativeTraits::Bool(3pm) User Contributed Perl Documentation MouseX::NativeTraits::Bool(3pm)NAME
MouseX::NativeTraits::Bool - Helper trait for Bool attributes
SYNOPSIS
package Room;
use Mouse;
has 'is_lit' => (
traits => ['Bool'],
is => 'rw',
isa => 'Bool',
default => 0,
handles => {
illuminate => 'set',
darken => 'unset',
flip_switch => 'toggle',
is_dark => 'not',
},
);
my $room = Room->new();
$room->illuminate; # same as $room->is_lit(1);
$room->darken; # same as $room->is_lit(0);
$room->flip_switch; # same as $room->is_lit(not $room->is_lit);
return $room->is_dark; # same as !$room->is_lit
DESCRIPTION
This provides a simple boolean attribute, which supports most of the basic math operations.
PROVIDED METHODS
These methods are implemented in MouseX::NativeTraits::MethodProvider::Bool. It is important to note that all those methods do in place
modification of the value stored in the attribute.
set Sets the value to true.
unset
Set the value to false.
toggle
Toggles the value. If it's true, set to false, and vice versa.
not Equivalent of 'not $value'.
METHODS
meta
method_provider_class
helper_type
SEE ALSO
MouseX::NativeTraits.
perl v5.14.2 2011-12-04 MouseX::NativeTraits::Bool(3pm)
Check Out this Related Man Page
Moose::Meta::Attribute::Native::Trait::Bool(3) User Contributed Perl Documentation Moose::Meta::Attribute::Native::Trait::Bool(3)NAME
Moose::Meta::Attribute::Native::Trait::Bool - Helper trait for Bool attributes
VERSION
version 2.0604
SYNOPSIS
package Room;
use Moose;
has 'is_lit' => (
traits => ['Bool'],
is => 'rw',
isa => 'Bool',
default => 0,
handles => {
illuminate => 'set',
darken => 'unset',
flip_switch => 'toggle',
is_dark => 'not',
},
);
my $room = Room->new();
$room->illuminate; # same as $room->is_lit(1);
$room->darken; # same as $room->is_lit(0);
$room->flip_switch; # same as $room->is_lit(not $room->is_lit);
return $room->is_dark; # same as !$room->is_lit
DESCRIPTION
This trait provides native delegation methods for boolean values. A boolean is a scalar which can be 1, 0, "", or "undef".
DEFAULT TYPE
If you don't provide an "isa" value for your attribute, it will default to "Bool".
PROVIDED METHODS
None of these methods accept arguments.
o set
Sets the value to 1 and returns 1.
o unset
Set the value to 0 and returns 0.
o toggle
Toggles the value. If it's true, set to false, and vice versa.
Returns the new value.
o not
Equivalent of 'not $value'.
BUGS
See "BUGS" in Moose for details on reporting bugs.
AUTHOR
Moose is maintained by the Moose Cabal, along with the help of many contributors. See "CABAL" in Moose and "CONTRIBUTORS" in Moose for
details.
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Infinity Interactive, Inc..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.16.2 2012-09-19 Moose::Meta::Attribute::Native::Trait::Bool(3)
Maybe it's just me being crazy, but I'm really worried. Someone broke into my room and typed, " rm - rf & /" into my box and now it's useless...all my files are gone. I was thinking about getting boot tape out and rebuilding the root filesystem from that...I'm so flustered. And I live in the... (1 Reply)
Here we go with a dumb question.
I am admin for a couple of old aix 5.2 and 5.3 machines and I am wondering if there is a way for me (without driving 500miles) to find out if there is room for additional hard drives in my machine.
Google is once again *sight* helpless... (5 Replies)
Hi,
My apologies if this question is so trivial ... I guess there really is a room for dummies ... :o
Anyway, just wanting to know if someone can please explain what the dot (.) infront of the command or script does and why it works and does not work in the following?
... (1 Reply)
I can not figure out how to iterate a perl command that inputs a value into columns and then combines them. I need to put a numerical value in column one and the word "Null" in all others, and then join at the end. I think the below is close, but I am not sure about the lines in bold. I... (7 Replies)
Hello All,
I want to get ride of Excel/word and want some software to draw my server room racks/server and overall topology. Please share you opinion/experience. thanks inadvance (1 Reply)