Commit | Line | Data |
---|---|---|
e7724627 | 1 | package Moose::Meta::Method::Accessor::Native::String::inc; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
e7724627 | 6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | ||
8b9641b8 | 8 | use Moose::Role; |
9 | ||
10 | with 'Moose::Meta::Method::Accessor::Native::Writer' => { | |
11 | -excludes => [ | |
12 | qw( | |
13 | _maximum_arguments | |
a486d5ad | 14 | _inline_optimized_set_new_value |
8b9641b8 | 15 | ) |
16 | ] | |
7f5ec80d | 17 | }; |
e7724627 | 18 | |
e7724627 | 19 | sub _maximum_arguments { 0 } |
20 | ||
21 | sub _potential_value { | |
53a4677c | 22 | my $self = shift; |
23 | my ($slot_access) = @_; | |
24 | ||
25 | return '(do { ' | |
26 | . 'my $val = ' . $slot_access . '; ' | |
27 | . '$val++; ' | |
28 | . '$val; ' | |
29 | . '})'; | |
e7724627 | 30 | } |
31 | ||
a486d5ad | 32 | sub _inline_optimized_set_new_value { |
53a4677c | 33 | my $self = shift; |
34 | my ($inv, $new, $slot_access) = @_; | |
e7724627 | 35 | |
a486d5ad | 36 | return $slot_access . '++;'; |
e7724627 | 37 | } |
38 | ||
8b9641b8 | 39 | no Moose::Role; |
40 | ||
e7724627 | 41 | 1; |