change role-to-role application to allow method shadowing
[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
8b9641b8 6use Moose::Role;
7
8with 'Moose::Meta::Method::Accessor::Native::Writer' => {
9 -excludes => [
10 qw(
11 _maximum_arguments
a486d5ad 12 _inline_optimized_set_new_value
8b9641b8 13 )
14 ]
15};
664e417b 16
664e417b 17sub _maximum_arguments { 0 }
18
a6ae7438 19sub _potential_value {
53a4677c 20 my $self = shift;
21 my ($slot_access) = @_;
a6ae7438 22
53a4677c 23 return $slot_access . ' ? 0 : 1';
a6ae7438 24}
25
a486d5ad 26sub _inline_optimized_set_new_value {
53a4677c 27 my $self = shift;
28 my ($inv, $new, $slot_access) = @_;
664e417b 29
a486d5ad 30 return $slot_access . ' = ' . $slot_access . ' ? 0 : 1;';
664e417b 31}
32
8b9641b8 33no Moose::Role;
34
664e417b 351;