use Moose;
has 'is_lit' => (
- traits => ['Bool'],
- is => 'rw',
- isa => 'Bool',
- default => 0,
- handles => {
+ traits => ['Bool'],
+ is => 'rw',
+ isa => 'Bool',
+ default => 0,
+ handles => {
illuminate => 'set',
darken => 'unset',
flip_switch => 'toggle',
);
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
+ $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
=head1 DESCRIPTION
=head1 PROVIDED METHODS
+None of these methods accept arguments.
+
=over 4
-=item B<set>
+=item * B<set>
-Sets the value to C<1>.
+Sets the value to C<1> and returns C<1>.
-=item B<unset>
+=item * B<unset>
-Set the value to C<0>.
+Set the value to C<0> and returns C<0>.
-=item B<toggle>
+=item * B<toggle>
Toggles the value. If it's true, set to false, and vice versa.
-=item B<not>
-
-Equivalent of 'not C<$value>'.
-
-=back
-
-=head1 METHODS
+Returns the new value.
-=over 4
+=item * B<not>
-=item B<meta>
+Equivalent of 'not C<$value>'.
=back