* Andy Armstrong <[EMAIL PROTECTED]> [2008-01-03 18:25]:
> On 3 Jan 2008, at 16:55, Ovid wrote:
>>  my $super = __PACKAGE__->can("SUPER::$sub") or die;
>>
>> This is OO code and that should actually read:
>>
>>  my $super = __PACKAGE__->can($sub) or die;
>
> Should that be __PACKAGE__->SUPER::can($sub) ?

No. That calls `can` from the superclass, but passes
`__PACKAGE__` as the invocant. Assuming that the subclass and the
superclass use the same inherited `can` method, the result is
therefore exactly the same.

The correct incantation is

    my ( $super ) = grep { $_->can( $sub ) } @ISA;

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to