[Catalyst] Base controllers and multiple inheritance
Zbigniew Lukasiak
zzbbyy at gmail.com
Thu Mar 6 21:40:05 GMT 2008
I would say don't use Catalyst::Controller::HTML::FormFu in that case
- the functionality it provides is rather basic.
By the way I am also working on a FormFu based CRUD Catalyst base
class (continuation of Catalyst::Example::InstantCRUD). Looks like it
has become fashionable thing recently.
--
Zbigniew
On Wed, Mar 5, 2008 at 8:36 AM, Byron Young <Byron.Young at riverbed.com> wrote:
> Hi,
>
> I've been using Catalyst for a project and decided to make some base
> controllers for common functionality. So far I've made two: CRUD, and
> List, for standard database operations and for sortable, paged listings
> of data. They work fine on their own but I'm running into trouble with
> multiple inheritance. If I have a controller for some database table
> that I want to inherit the actions from both CRUD and List, only the
> first one inherited will initialize properly.
>
> The inheritance looks like this:
>
> Catalyst::Controller
> / \
> / \
> / \
> / Catalyst::Controller::HTML::FormFu
> / |
> MyApp::Base::Controller::List |
> \ |
> \ MyApp::Base::Controller::CRUD
> \ /
> \ /
> \ /
> MyApp::Controller::SomeDatabaseTable
>
>
> Each of the controller base classes has a new() method which sets up
> config data and does error checking and whatnot. If I inherit both of
> my base classes, only new() on the first inherited is called. I've
> tried calling $class->NEXT::new(@_) in each, and I've also tried
> Class::C3's $class->maybe::next::method(@_), but new() is still not
> called down the second inheritance chain. When I tried the Class::C3
> approach I called Class::C3::initialize() in MyApp.pm - I wasn't sure
> where to call it so I tried before and after MyApp->setup() - still no
> luck.
>
> Can somebody tell me why new() isn't called down both paths?
>
> Thanks,
> Byron
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
More information about the Catalyst
mailing list