Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Prepend a Moose attribute when changed

by Haarg (Curate)
on Feb 08, 2019 at 13:19 UTC ( #1229611=note: print w/replies, xml ) Need Help??


in reply to Prepend a Moose attribute when changed

It may make more sense to prepend the extra string in your accessor.
package Test; use Moose; my $prepend = '/some_string/'; has appended => (is => 'rw'); around appended => sub { my ($orig, $self) = (shift, shift); my $value = $self->$orig(@_); return $prepend . $value; }; 1;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1229611]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2020-10-31 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (290 votes). Check out past polls.

    Notices?