in reply to Action at a distance
And when searching for a clone method I found this in the documentation
$y = $x->copy(); # make a copy (unlike $y = $x)
So maybe try this?
HTH! :)
> This behaviour can be avoided if I use the overloaded ++ operator instead of the binc() method call:
Well you could "overload" assignments via tie, to always do a copy ...
see overload#Overloadable Operations:
> Simple assignment is not overloadable (the = key is used for the "Copy Constructor"). Perl does have a way to make assignments to an object do whatever you want, but this involves using tie(), not overload - see "tie" in perlfunc and the "COOKBOOK" examples below.
Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Action at a distance
by syphilis (Archbishop) on Nov 03, 2022 at 12:42 UTC | |
|
Re^2: Action at a distance (updated)
by ikegami (Patriarch) on Nov 03, 2022 at 14:29 UTC | |
by LanX (Saint) on Nov 03, 2022 at 15:05 UTC | |
|
Re^2: Action at a distance (updated)
by ikegami (Patriarch) on Nov 03, 2022 at 14:15 UTC | |
by LanX (Saint) on Nov 03, 2022 at 14:24 UTC | |
by ikegami (Patriarch) on Nov 03, 2022 at 14:30 UTC |