Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: RFC: Class::DispatchToAll

by TheDamian (Priest)
on Jul 11, 2002 at 03:09 UTC ( #180926=note: print w/replies, xml ) Need Help??


in reply to RFC: Class::DispatchToAll

In the same vein, the next release of NEXT.pm will feature a new pseudo-class: EVERY. This will allow you to write:
$obj->EVERY::foo();
to cause all of the foo methods inherited by $obj to be called.

Replies are listed 'Best First'.
Re: Re: RFC: Class::DispatchToAll
by domm (Chaplain) on Jul 11, 2002 at 07:53 UTC
    Will it also be possible to collect the return values of those method calls?
    -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
      Yes. Each method will be called in the same context as the original call through EVERY::, and the collective return value will be:
      • a ref to an array of scalars (in scalar context)
      • a list of refs to arrays (in list context)
      That is, EVERY:: will aggregrate the individual return values, and return them in a form appropriate to the calling context.
        Should I then wait for your release and dump my code, wait for your release, benchmark and then dump the slower code, or still put Class::DispatchToAll on CPAN (in compliance with TMTOWTDI, especially as I might extend my code to do some other stuff (like width-first traversal, or returning the package a method was found in and the return value..))?
        -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://180926]
help
Chatterbox?
robby_dobby is still not used to PM's interface. /o\
[oiskuu]: War. War never changes.
[robby_dobby]: "My cat is a very good mouser" -- that's a great way to identify a Brit among a crowd :-)
thezip looks around to see no one else dancing to Piazzola...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-11-17 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?