On Thu, 24 Aug 2000 13:27:01 -0700, Nathan Wiger wrote:

>It's a pain if you want to support both function-oriented and
>object-oriented calling forms, as CGI.pm does. For example, you can use
>both of these:
>
>   print header;
>   print $r->header;
>
>with CGI.pm. Now you need a self_of_default special method, since
>sometimes $_[0] has a class ref and sometimes it has the first method
>argument.

Don' forget to mention that if the sub can also be used as a class
method, the is NO WAY to distinguish between

        CGI->header
and
        header("CGI")

Hence, with some values for the functional argument, the detection
mechanism is unreliable.

Either $ME or self() (which, BTW, is more related to caller() than to
ref()) is 100% reliable.

-- 
        Bart.

Reply via email to