change role-to-role application to allow method shadowing
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Counter / dec.pm
CommitLineData
04e05413 1package Moose::Meta::Method::Accessor::Native::Counter::dec;
2
3use strict;
4use warnings;
5
8b9641b8 6use Moose::Role;
7
8with 'Moose::Meta::Method::Accessor::Native::Writer' => {
9 -excludes => [
10 qw(
11 _minimum_arguments
12 _maximum_arguments
a486d5ad 13 _inline_optimized_set_new_value
8b9641b8 14 )
15 ]
16};
04e05413 17
1e2c801e 18sub _minimum_arguments { 0 }
19sub _maximum_arguments { 1 }
04e05413 20
21sub _potential_value {
53a4677c 22 my $self = shift;
23 my ($slot_access) = @_;
04e05413 24
1e2c801e 25 return $slot_access . ' - (defined $_[0] ? $_[0] : 1)';
04e05413 26}
27
a486d5ad 28sub _inline_optimized_set_new_value {
53a4677c 29 my $self = shift;
30 my ($inv, $new, $slot_access) = @_;
04e05413 31
a486d5ad 32 return $slot_access . ' -= defined $_[0] ? $_[0] : 1;';
04e05413 33}
34
8b9641b8 35no Moose::Role;
36
04e05413 371;