make native trait inlining work
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / String / chomp.pm
1 package Moose::Meta::Method::Accessor::Native::String::chomp;
2
3 use strict;
4 use warnings;
5
6 our $VERSION = '1.19';
7 $VERSION = eval $VERSION;
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 use Moose::Role;
11
12 with 'Moose::Meta::Method::Accessor::Native::Writer' => {
13     -excludes => [
14         qw(
15             _maximum_arguments
16             _optimized_set_new_value
17             _return_value
18             )
19     ]
20 };
21
22 sub _maximum_arguments {0}
23
24 sub _potential_value {
25     my $self = shift;
26     my ($slot_access) = @_;
27
28     return '(do { '
29              . 'my $val = ' . $slot_access . '; '
30              . '@return = chomp $val; '
31              . '$val '
32          . '})';
33 }
34
35 sub _optimized_set_new_value {
36     my $self = shift;
37     my ($inv, $new, $slot_access) = @_;
38
39     return '@return = chomp ' . $slot_access;
40 }
41
42 sub _return_value {
43     my $self = shift;
44     my ($slot_access) = @_;
45
46     return '$return[0]';
47 }
48
49 no Moose::Role;
50
51 1;