in reply to Operator overloading, nomethod, and Introspection
The `nomethod' function does not have the ability to decline to handle a request. If you have implemented some of the methods, the value of `fallback' becomes relevant. The `undef' value is reasonably sane - if an unimplemented method is called, it attempts to create one from what is already implemented. If that fails, it calls your `nomethod' function. If you didn't have a `nomethod' function, it would throw an exception. Since you promised to handle everything by specifying a `nomethod' function, no exceptions will be thrown. If you really want to decline to handle a method, throw the exception yourself from inside your `nomethod' function.
The `nomethod' function will not handle ${}, @{}, %{}, &{}, or *{} overloading. You will have to overload those manually.
For Data::Postponed, I explicitly overloaded everything. Everything. The idea is, when I promised that the value would appear to act like a normal value, I took that and applied it to everything available. This had the side effect of not allowing me to actually store anything inside the object because now I couldn't dereference it either. I used an inside-out implementation to avoid that problem.
The following snippet produces a list of overloaded methods.
grep overload::Method( $some_object, $_ ), values %overload::ops
|
|---|