Just another Perl shrine | |
PerlMonks |
Re: Creating modules with OO and functional interfaces.by ariels (Curate) |
on May 14, 2002 at 11:42 UTC ( [id://166419]=note: print w/replies, xml ) | Need Help?? |
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).
In Section
Seekers of Perl Wisdom
|
|