use Moose::Role;
use Moose::Meta::Attribute::Native::MethodProvider::Bool;
-our $VERSION = '0.87';
+our $VERSION = '0.89_01';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
with 'Moose::Meta::Attribute::Native::Trait';
-sub _default_is { 'rw' }
+sub _default_is { 'rw' }
sub _helper_type { 'Bool' }
# NOTE: we don't use the method provider for this module since many of
package Room;
use Moose;
- use Moose::AttributeHelpers;
has 'is_lit' => (
- metaclass => 'Bool',
+ traits => ['Bool'],
is => 'rw',
isa => 'Bool',
default => 0,
darken => 'unset',
flip_switch => 'toggle',
is_dark => 'not',
- }
+ },
);
my $room = Room->new();
This provides a simple boolean attribute, which supports most of the
basic math operations.
-=head1 METHODS
+=head1 PROVIDED METHODS
-=over 4
+These methods are implemented in
+L<Moose::Meta::Attribute::Native::MethodProvider::Bool>. It is important to
+note that all those methods do in place modification of the value stored in
+the attribute.
-=item B<meta>
+=over 4
-=item B<method_constructors>
+=item B<set>
-=item B<has_method_provider>
+Sets the value to C<1>.
-=item B<method_provider>
+=item B<unset>
-=back
+Set the value to C<0>.
-=head1 PROVIDED METHODS
+=item B<toggle>
-It is important to note that all those methods do in place
-modification of the value stored in the attribute.
+Toggles the value. If it's true, set to false, and vice versa.
-=over 4
+=item B<not>
-=item I<set>
+Equivalent of 'not C<$value>'.
-Sets the value to C<1>.
+=back
-=item I<unset>
+=head1 METHODS
-Set the value to C<0>.
+=over 4
-=item I<toggle>
+=item B<meta>
-Toggle the value. If it's true, set to false, and vice versa.
+=item B<method_constructors>
-=item I<not>
+=item B<has_method_provider>
-Equivalent of 'not C<$value>'.
+=item B<method_provider>
=back