in reply to Creating modules with OO and functional interfaces.
CGI has this feature; it seems to live in the function ``<samp>self_or_default</samp>'' and maybe also ``<samp>self_or_CGI</samp>'' (both in the main <samp>CGI.pm</samp> file). You might examine its implementation -- it checks that the first argument is a reference, or that it ``isa-CGI'' (the first test is probably just optimizing for the common case).
|
---|