There's more than one way to do things | |
PerlMonks |
Re^2: Action at a distance (updated)by ikegami (Patriarch) |
on Nov 03, 2022 at 14:29 UTC ( [id://11147945]=note: print w/replies, xml ) | Need Help?? |
I wouldn't go with tie (if it even works?). I'd overload = to automatically clone the object on assignment. Another approach is to use immutable objects. Such a class wouldn't provide a method for incrementing the object; it would provide a method that returns a new object with the higher value. Both of these approaches add the unnecessary computational and memory overhead of creating clones in situations where they aren't needed.
In Section
Seekers of Perl Wisdom
|
|