On Thu, Feb 24, 2011 at 9:41 AM, Dave Mitchell wrote:
This was fixed in a recent blead. Under blead, you get instead:
ok 1 - +, tied hash ok 2 - +=, normal hash # Operation "=": no method found, argument in overloaded package Test +at /tmp/p line 52. ...because with a tie, it can't determine whether its safe to skip using the copy constructor, so it always calls it. Adding one, e.g.
'=' => sub { bless [ @{$_[0]} ], 'Test' },makes all three tests pass.
So starting with 5.14, you'll be able to do
use overload '+' => \&append, '+=' => \&append, '=' => => sub { bless [ @{$_[0]} ], 'Test' };
In reply to Re: Mixing tie %hash and overload results in strange behavior
by ikegami
in thread Mixing tie %hash and overload results in strange behavior
by robhoelz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |