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