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

Re: MMD as an object.

Thread Previous | Thread Next
From:
Miroslav Silovic
Date:
March 11, 2005 02:22
Subject:
Re: MMD as an object.
Message ID:
42316A48.5000509@puremagic.com
lt@toetsch.at wrote:

>Ok. If you'd really need such random dispatch, it could be done like
>this, when I interpret A12 correctly:
>
>  sub run_random_bar($x) {
>     my @meths = WALKMETH($x, :method('bar'));
>     my $meth = @meths[rand(@meths.elems)];
>     $meth($x);
>  }
>
>or even with
>
>  my sub bar($x) {...} # same body as above
>
>  bar($x);
>  
>
This is enough to make me completely happy. :)

    Miro


Thread Previous | 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