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