Think about Loose Coupling | |
PerlMonks |
Re^2: Moose Trait to Add a Method to an Attribute ( Moose/Meta/Method/Accessor/Native/Array/apply.pm )by choroba (Cardinal) |
on Oct 08, 2016 at 09:20 UTC ( [id://1173526]=note: print w/replies, xml ) | Need Help?? |
Thanks a lot! It's definitely a step in the right direction. But it modifies the Array trait globally, instead of creating a new one. _potential_value is not only confusing/disgusting, but also private and undocumented :-( I inspected some other methods in the same directory (e.g. map), which uses _return_value instead, but sort_in_place is much better because it shows how to modify the elements of the list. Thank again for pointing me to it. However, it still doesn't really modify the values in place: it returns a reference to a new anonymous array containing the new values. Update: I had to quotequote InvalidArgumentToMethod in the code, otherwise I got > Could not create writer for list because Failed to compile source: Bareword "InvalidArgumentToMethod" not allowed while "strict subs" in use at native delegation method My::apply_to_list (apply) of attribute list
In Section
Seekers of Perl Wisdom
|
|