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

In reply to Re: Operator overloading, nomethod, and Introspection by diotalevi
in thread Operator overloading, nomethod, and Introspection by renodino

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.