in reply to Re: Class or Object composition ??
in thread Class or Object composition ??

Which modules on CPAN are good examples of the plugin style architecture?
Template? DBIx::Class?

Replies are listed 'Best First'.
Re^3: Class or Object composition ??
by perrin (Chancellor) on Oct 04, 2006 at 18:52 UTC
    There are not many examples of composition on CPAN because CPAN is mostly smaller pieces. DBIx::Class uses inheritance, modified by Class::C3. Template Toolkit has an excellent plugin API, but that's kind of separate from composition.

    However, if you look at the TT code, it does use composition internally. For example, a Template::Provider is a service for finding templates which the main Template object points to. You can implement the API and create a Template object that points to yours instead of the default one. It's a very good system for replacing bits and pieces.

    Another plugin system that worked out really well is Crypt::CBC, but again it's not so much composition as a specific plugin API.