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
MooseX::AttributeHelpers::Trait::Bool(3pm) User Contributed Perl Documentation MooseX::AttributeHelpers::Trait::Bool(3pm)NAME
MooseX::AttributeHelpers::Bool - simple boolean attribute
SYNOPSIS
package Room;
use Moose;
use MooseX::AttributeHelpers;
has 'is_lit' => (
metaclass => 'Bool',
is => 'rw',
isa => 'Bool',
default => sub { 0 },
provides => {
set => 'illuminate',
unset => 'darken',
toggle => 'flip_switch',
not => 'is_dark'
}
);
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.
METHODS
meta
helper_type
method_constructors
has_method_provider
method_provider
PROVIDED METHODS
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 1.
unset
Set the value to 0.
toggle
Toggle the value. If it's true, set to false, and vice versa.
not Equivalent of 'not $value'.
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Jason May
COPYRIGHT AND LICENSE
Copyright 2007-2009 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-01-02 MooseX::AttributeHelpers::Trait::Bool(3pm)
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)