develooper Front page | perl.perl6.language | Postings from May 2005

How do I... invoke a method reference

Thread Next
From:
Ingo Blechschmidt
Date:
May 19, 2005 13:53
Subject:
How do I... invoke a method reference
Message ID:
d6itr0$5nt$2@sea.gmane.org
Hi,

  class Foo {
    method bar() { 42 }
    method baz() { &bar }
  }

  my $ref = Foo.baz;
  $ref();         # Don't think this will work
                  # (Error: No invocant specified or somesuch)
  $ref(Foo.new);  # But will this work?

How do I specify multiple invocants (when dealing with multi method
references)?


--Ingo

-- 
Linux, the choice of a GNU | To understand recursion, you must first
generation on a dual AMD   | understand recursion.  
Athlon!                    | 


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About