[html-formfu] inheritance question
Byron Young
Byron.Young at riverbed.com
Mon Feb 23 19:00:02 GMT 2009
Carl Franks wrote on 2009-02-23:
> 2009/2/22 Malcolm <mjh-formfu at liminalflux.net>:
>> On Sunday 22 February 2009, Malcolm wrote:
>>> There's probably something obvious I'm completely missing, but can
>>> someone explain (or point me at the right place to RTFM, as I can't
>>> find it) why this works:
>>>
>>> package MySite::Controller::Profile;
>>> use parent qw(MySite::Controller::Base
> Catalyst::Controller::HTML::FormFu
>>> );
>>>
>>> but this:
>>>
>>> package MySite::Controller::Profile;
>>> use parent qw(Catalyst::Controller::HTML::FormFu
>>> MySite::Controller::Base);
>>>
>>> fails to process forms at all ($c->stash->{form} is empty).
>> Though it would probably help if I got my examples the correct way
>> around.
>>
>> package MySite::Controller::Profile;
>> use parent qw(Catalyst::Controller::HTML::FormFu
> MySite::Controller::Base);
>> works.
>>
>> package MySite::Controller::Profile;
>> use parent qw(MySite::Controller::Base
> Catalyst::Controller::HTML::FormFu);
>> does not.
> Without the code for MySite::Controller::Base, I can only guess that
> it's inheriting from Catalyst::Controller which has a create_action sub,
> meaning that C::C::HTML::FormFu's won't be called.
>
> Carl
>
Malcom,
I put this bit of code in my multiply-inherited controllers to make sure everybody's create_action sub is called:
use Class::C3;
sub create_action {
my $self = shift;
return $self->maybe::next::method(@_);
}
It works for me. If somebody has a better way to get around the problem, I'd love to hear it.
Byron
More information about the HTML-FormFu
mailing list