develooper Front page | perl.perl5.porters | Postings from December 2010

Make $obj->$method honours "&{}" overloading on $method

Thread Next
Vincent Pit
December 5, 2010 11:12
Make $obj->$method honours "&{}" overloading on $method
Message ID:
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.

This allows to define object-oriented lexical methods that aren't
necessarily blessed code references.

If nobody has objected to it, I'll push it tuesday evening.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About