Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: RFC: Class::DispatchToAll

by djantzen (Priest)
on Jul 11, 2002 at 01:31 UTC ( #180919=note: print w/ replies, xml ) Need Help??


in reply to RFC: Class::DispatchToAll

At first blush this seems likely to introduce more (and more subtle) errors than it's worth. It requires that all of the various method bodies be written in such a way that they not step on one another's toes, but this is exactly opposite the usual concern when people write multiple versions of the same method; namely, to override functionality present at higher levels in the hierarchy!

The one place I can see using this is in initializer methods which are (often) meant to be called in sequence all the way up the tree. (Cf. inheritance: constructors). However NEXT already does just this.


Comment on Re: RFC: Class::DispatchToAll
Re: Re: RFC: Class::DispatchToAll
by domm (Chaplain) on Jul 11, 2002 at 07:52 UTC
    but this is exactly opposite the usual concern when people write multiple versions of the same method; namely, to override functionality present at higher levels in the hierarchy!

    When using this module, I do not want to override methods, but explicitly call all of them (and collect the return values). You can still use normal Perl behaviour, Class::DispatchToAll is meant as an alternative to the Perl Inheritance mechanism, not as a replacement. Only use it when you need it. And it only is used when you explictly call for it...

    However NEXT already does just this.

    As frag pointed out, you would have to alter each and every method to include $_[0]->NEXT::method() at the end. Doesn't seems lazy enough to me...

    -- #!/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://180919]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-12-29 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls