[Catalyst-dev] Documentation

Matt S Trout dbix-class at trout.me.uk
Fri May 12 22:16:51 CEST 2006


Brian Cassidy wrote:
> Also, as discussed on IRC,
> 
> Regarding documentation, if there were such a section on how to write custom
> models and views then we should include an important best practice for a
> specific situation...
> 
> I'm finding it hard to find the right wording but something like
> 
> * Creating models and views with a specific base class
> 
> Several older models on CPAN have what I call the "multiple-inheritance
> new() hack" which looks something like this:
> 
> package Catalyst::Model::MyClass;
> 
> use base qw( Catalyst::Base MyClass );
> 
> sub new {
>     my( $class, $c, $options ) = @_;
> 
>     # ...or some variant of the following:
>     $class->MyClass::new( %{ $class->NEXT::new( $c, $options ) } );
> }
> 
> See Catalyst::Model::Gedcom 0.02 [1] for an example.
> 
> Instead the preferred method would to use COMPONENT(). I can't quite
> remember what version introduced it, though.

Pretty sure it was part of my changes for 5.50 when I refactored the 
dispatcher and broke Catalyst::Componet and Catalyst::Base in two.



More information about the Catalyst-dev mailing list