in reply to Feedback on Class::Container

Very interesting module. I think there's a good bit of overlap with Class::MethodMaker which also has some advanced composition support. I think that if I were implementing Class::Container I would do it as a set of new method generators for Class::MethodMaker.

Reading the POD the only thing that wasn't clear to me was what the "parse" key in the hash passed to valid_params() does. Also, how does the Params::Validate tie-in work exactly? Perhaps you could add an example.

-sam

Replies are listed 'Best First'.
Re: Re: Feedback on Class::Container
by kwilliams (Sexton) on Jul 01, 2002 at 01:25 UTC
    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
      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