On 16 Dec 2000, Randal L. Schwartz wrote: > > >>> So: What I would love to see in Perl 6 is a way of having a single >>> scalar that holds a reference to a particular instance's method. >>> Is there any chance that this would be considered? Or is this already >>> possible in Perl 5 but I have missed it? > > my $methref = sub { $foo->method(@_) }; > > You missed it. :) Just be sure that $foo is not a package variable, > so that a proper closure is created. Again, thanks. This should probably be given a slightly more prominent position in perltoot and perlobj (if it is there at all). I have read those many times and never seen, or even thought of, this way of doing it. -- Ian Hickson )\ _. - ._.) fL Netscape, Standards Compliance QA /. `- ' ( `--' +1 650 937 6593 `- , ) - > ) \ irc.mozilla.org:Hixie _________________________ (.' \) (.' -' __________Thread Previous | Thread Next