Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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
Domain Nodelet?
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 wandering the Monastery: (3)
As of 2021-09-28 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?