Beginning of dzilization
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Bool / toggle.pm
CommitLineData
664e417b 1package Moose::Meta::Method::Accessor::Native::Bool::toggle;
2
3use strict;
4use warnings;
5
664e417b 6our $AUTHORITY = 'cpan:STEVAN';
7
8b9641b8 8use Moose::Role;
9
10with 'Moose::Meta::Method::Accessor::Native::Writer' => {
11 -excludes => [
12 qw(
13 _maximum_arguments
a486d5ad 14 _inline_optimized_set_new_value
8b9641b8 15 )
16 ]
17};
664e417b 18
664e417b 19sub _maximum_arguments { 0 }
20
a6ae7438 21sub _potential_value {
53a4677c 22 my $self = shift;
23 my ($slot_access) = @_;
a6ae7438 24
53a4677c 25 return $slot_access . ' ? 0 : 1';
a6ae7438 26}
27
a486d5ad 28sub _inline_optimized_set_new_value {
53a4677c 29 my $self = shift;
30 my ($inv, $new, $slot_access) = @_;
664e417b 31
a486d5ad 32 return $slot_access . ' = ' . $slot_access . ' ? 0 : 1;';
664e417b 33}
34
8b9641b8 35no Moose::Role;
36
664e417b 371;