[Catalyst-dev] Re: [Catalyst] use base vs use parent

Tomas Doran bobtfish at bobtfish.net
Wed Aug 26 00:06:34 GMT 2009


ccing in -dev, as this is relevant there, and and contains a brain  
dump :_)

> If it's a Moose class should you always use "extends" over both?

Yep.

> Hum, the CatalystAndMoose manual doesn't even show the application  
> base class inheriting:
>
> http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/CatalystAndMoose.pod#THE_CONTEXT_CLASS

I did mangle trunk to show it as inheriting recently.

> Unlike in the Intro which shows "use parent."

Yes, lots of places (and the helpers) haven't been updated yet.

This work is underway (helpers haven't been done as I for one haven't  
wanted to work on the horrible crap that exists at the moment until  
the GSOC project is a bit more finished, and makes it less horrible)!

> (The CatAndMoose page also shows $app, which isn't defined).

<cough> yes, also fixed in trunk of the manual.

New -Manual release is waiting on some more fixes, which I'll try to  
get to in the next week or two.

Note that the tutorial being updated will wait until it can match what  
the helpers generate, without needing a 'and now we port to Moose'  
section...

use base and use parent are both still fully supported, including  
weird franken-combinations of 5.80 => use base => use Moose type  
inheritance..

> Not sure if this is by design or not, but the application base class  
> automatically inherits from Catalyst and Catalyst::Controller.

It was originally by design.

However the application class being @ISA ::Controller is bad, wrong  
and deprecated, and removing it wholesale is a prerequisite for the  
app/ctx split. Catalyst spitting out warnings when you have actions in  
your MyApp.pm class (and therefore need it to be @ISA Controller) will  
be appearing presently. (I.e. the code is present and commented out  
until the tests are fixed - which is happening right now in a branch) :)

You _can_ have action methods in your root MyApp.pm, but as noted  
above this a baaad and the scaffold has generated by   
a ::Controller::Root which configures itself into the root namespace  
for several years..

Cheers
t0m




More information about the Catalyst-dev mailing list