From: Graham Barr [mailto:[EMAIL PROTECTED]]
> On Tue, Sep 04, 2001 at 03:03:04PM -0400, Dan Sugalski wrote:
> > At 01:58 PM 9/4/2001 -0500, Garrett Goebel wrote:
> > >From: Dan Sugalski [mailto:[EMAIL PROTECTED]]
> > > > At 10:32 AM 9/4/2001 +0100, Piers Cawley wrote:
> > > > Can you see any use of a sub knowing it was called via 
> > > > a method call?
> > >
> > >So that attributes which cause code to be executed before 
> > >or after a subroutine implementation's execution might
> > >behave differently depending on whether the sub were
> > >executed as a function or a method?
> > 
> > Okay. I'll see about finding a spot to squirrel away call 
> > type somewhere.
> 
> Hm, interesting. Is this a method or function call ?
> 
>  $ref = $obj.can('foo');
>  $ref.($obj);

I'm still fairly shaky on Perl6 syntax, but in Perl5

>perldoc UNIVERSAL

gives:

can ( METHOD )
    `can' checks if the object has a method called `METHOD'. If it does
    then a reference to the sub is returned. If it does not then *undef*
    is returned.

    `can' can be called as either a static or object method call.

The fact that the above isn't exactly true (subroutines are not checked for
verify that the :method attribute is set) is beside the point.

I'd hope that $ref.method would return a true value. And that $ref would be
executed as a method.

Reply via email to