Vincent Pit wrote: > The attached patch makes "Package->$method" and "$obj->$method" call > "&{}" overloading on $method whenever present. > In that case, it is equivalent to "Package->$ret" and "$obj->$ret", > where $ret is the value returned from the overloading callback ; except > when $ret is a scalar reference, in which case $$ret is used as the > method name. Why the special case for scalar references? I would expect ‘$bar = \$_; $foo->$bar’ to do this (which it does currently): Can't call method "SCALAR(0x826d70)" on an undefined value at -e line 1. If $_ is blessed into a class, then string overloading will kick in: $ perl5.10.1 -e 'bless \$_; use overload q\""\=>sub{"aaaa"};$bar = \$_; $foo->$bar' Can't call method "aaaa" on an undefined value at -e line 1. The &{} overloading sounds fine to me, as it’s a bug fix as far as I’m concerned.Thread Previous | Thread Next