in reply to A warning about overloading assignment methods
I think if i understand this properly you can see the same thing at work without overload. Try this:
package T; use Data::Dump::Streamer; sub foo { \$_[0] } sub bar { my $x=shift; \$x } my $o=bless [],'T'; Dump($o->foo,$o->bar,$o)->Names(qw(foo bar o))->Out(); __END__ $foo = \$o; $bar = \do { my $v = 'V: $o' }; $o = bless( [], 'T' ); $$bar = $o;
What happening here is that you seeing the difference between copy semantics (what happens with assignment) and aliasing semantics (what happens when you take a reference to an alias).
But i know you well enough to know this isnt a surprise to you, so Im wondering if you could explain in more detail perhaps with a minimal case we can run to see the effect you mean.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A warning about overloading assignment methods
by diotalevi (Canon) on Apr 20, 2005 at 08:43 UTC |