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

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

Replies are listed 'Best First'.
Re: Re: Re: Re: Feedback on Class::Container
by kwilliams (Sexton) on Jul 01, 2002 at 02:29 UTC

    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