Implemented inlning for all string methods.
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / String / chomp.pm
CommitLineData
e7724627 1package Moose::Meta::Method::Accessor::Native::String::chomp;
2
3use strict;
4use warnings;
5
6our $VERSION = '1.13';
7$VERSION = eval $VERSION;
8our $AUTHORITY = 'cpan:STEVAN';
9
10use base 'Moose::Meta::Method::Accessor::Native::String::Writer';
11
12sub _minimum_arguments { 0 }
13sub _maximum_arguments { 0 }
14
15sub _potential_value {
16 my ( $self, $slot_access ) = @_;
17
18 return "( do { my \$val = $slot_access; chomp \$val; \$val } )";
19}
20
21sub _inline_set_new_value {
22 my ( $self, $inv, $new ) = @_;
23
24 return $self->SUPER::_inline_set_new_value(@_)
25 if $self->_value_needs_copy;
26
27 my $slot_access = $self->_inline_get($inv);
28
29 return "chomp ${slot_access}";
30}
31
321;