On Monday, October 14, 2002, at 11:57  AM, Trey Harris wrote:
>>      class SomeClass {
>>              cmethod class_method     {...}   # via a keyword
>>              method  instance_method  {...}   # via another keyword
>>              sub     dont_care_method {...}   # check it yourself, as 1st arg
>>      }
>>
>> Except for the fact that the word 'cmethod' is not a terribly 
>> intuitive
>> choice.
>
> I don't know about this precisely, but I will say that I have a strong
> intuition that C<sub> within a class block I<should> mean something, 
> and
> be neither a syntax error nor a synonym for C<method>.

Sorry, what I meant was that you would just use 'sub' when you don't 
want the enforcement of invocant that either of the first two imply, 
i.e. you'd use sub in the perl5 way:

sub dont_care_method {
        my $self = shift;
        if (ref $self) {
                ...
        } else {
                ...
        }
}

So sub is still just a perl5 sub, where the invocant is passed as the 
first arg.

MikeL

Reply via email to