b6a9a2489d0d457690d2afd9359a841c7a67e785
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / String / chop.pm
1 package Moose::Meta::Method::Accessor::Native::String::chop;
2
3 use strict;
4 use warnings;
5
6 our $VERSION = '1.13';
7 $VERSION = eval $VERSION;
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 use base 'Moose::Meta::Method::Accessor::Native::String::Writer';
11
12 sub _minimum_arguments { 0 }
13 sub _maximum_arguments { 0 }
14
15 sub _potential_value {
16     my ( $self, $slot_access ) = @_;
17
18     return "( do { my \$val = $slot_access; chop \$val; \$val } )";
19 }
20
21 sub _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 "chop ${slot_access}";
30 }
31
32 1;