Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 studying the Monastery: (10)
As of 2020-04-01 09:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    To "Disagree to disagree" means to:









    Results (187 votes). Check out past polls.

    Notices?