[Catalyst] Catalyst::Controller::DBIC::Transaction Integration

Tomas Doran bobtfish at bobtfish.net
Tue May 19 18:35:11 GMT 2009


On 16 Mar 2009, at 10:45, Carl Franks wrote:
> I think now that Catalyst::Controller::HTML::FormFu isn't first in the
> inheritance list, its create_action() isn't being called.

Yuk, as we get plain old perl method dispatch order, so you get:

Other::Thing => Catalyst::Controller;

I guess adding the incantation:
use MRO::Compat;
use mro 'c3';

to the controllers in question would also help, as the C3 dispatch  
order would be:

Other::Thing => Controller::FormFu => Catalyst::Controller.

I note that you say $self->SUPER in Controller::FormFu, which is a  
bad idea - this is certain to call the method in your direct parent  
(i.e. Catalyst::Controller), excluding any other multiply inherited  
base classes which would like a stab at create_action also :_(

> If any Cat dev could point me to a Cat controller that does the action
> registering correctly, so I can fix C-C-HTML-FormFu, I'd very much
> appreciate it.

In 5.80, a better solution might be to use a controller role, and use  
an around modifier on get_action_methods'. I'm not sure if that would  
actually be more elegant or not, but using Moose roles puts you at  
less risk of getting hurt by multiple inheritance.

I appreciate that this would probably be a rather large change for  
Controller::FormFu however :)

Cheers
t0m




More information about the Catalyst mailing list