Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Feedback on Class::Container

by kwilliams (Sexton)
on Jul 01, 2002 at 01:25 UTC ( #178440=note: print w/replies, xml ) Need Help??


in reply to Re: Feedback on Class::Container
in thread Feedback on Class::Container

Hi Sam,

I'm not sure it's very similar to Class::MethodMaker. I had a hard time wading through MethodMaker's docs, though - what part do you mean by "advanced composition support"?

The "parse" key doesn't do anything - the remarks after that example say that unknown parameters like "parse" are just ignored. In Mason, it's actually used to parse things from the httpd.conf file, but Class::Container knows nothing about this.

-Ken

Replies are listed 'Best First'.
Re: Re: Re: Feedback on Class::Container
by samtregar (Abbot) on Jul 01, 2002 at 01:34 UTC
    Class::MethodMaker has a method maker called "object" that declares a slot to be of a particular object type. For example:

    use Class::MethodMaker new_hash_init => 'new', object => [ HTML::Mason::Lexer => 'lexer' ];

    You can then choose to proxy selected methods from the contained class. For example, to create a class called CGI::Simple that contains a CGI.pm object in a slot called 'query' and proxies new() and param() to it:

    package CGI::Simple; use Class::MethodMaker new_hash_init => 'new', object => [ CGI => { slot => 'query', comp_mthds => [ 'new', 'param' ], } ];

    This seems just nextdoor to your module to me.

    -sam

      samtregar wrote:
      Class::MethodMaker has a method maker called "object" that declares a slot to be of a particular object type.

      Oh, I see. Thanks for the clarification. However, this seems quite orthogonal to Class::Container. One might want to use Class::Container to create the objects with the proper parameters, then use Class::MethodMaker to create interfaces to the objects, possibly using the proxies Class::MethodMaker provides.

      It's quite possible that someone would want to use both in the same project, but that doesn't suggest to me that they should be in the same module.

      -Ken
        Given the width of the Class::MethodMaker API I'd be surprised if any OO method generation was truly orthoganal to it! After all, the main purpose of your module is to provide a new() for sub-classes that performs certain convenient functions with respect to composition. That sounds a lot like the what many of the method makers in Class::MethodMaker do already.

        However, I'm not meaning to suggest that having Class::Container as a separate module is bad. People may want to use it who have no need for the larger functionality of Class::MethodMaker.

        As I understood your question, you asked if your new module fit anywhere in the existing OO landscape. I happen to think it does. Whether you choose to put it where I think it might fit is another question entirely.

        -sam

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://178440]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2021-06-12 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (53 votes). Check out past polls.

    Notices?