FAQ
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).

where MySite::Controller::Base, just provides a couple of utility functions.

Also if MySite::Controller::Base inherits from
Catalyst::Controller::HTML::FormFu, and MySite::Controller::Profile just
inherits from MS::C::Base, I get this same effect (no forms).


Now, it's not a problem to put C::C::HTML::FormFu at the end of the leaf
class, I'm just curious as to why I have to.

Using Moose and extends instead of "use parent" has the same effect.

Search Discussions

  • Malcolm at Feb 22, 2009 at 10:15 pm

    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.
  • Carl Franks at Feb 23, 2009 at 9:33 am

    2009/2/22 Malcolm <mjh-formfu@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
  • Byron Young at Feb 23, 2009 at 7:00 pm

    Carl Franks wrote on 2009-02-23:
    2009/2/22 Malcolm <mjh-formfu@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
  • Malcolm at Feb 26, 2009 at 1:07 am

    On Monday 23 February 2009, Carl Franks wrote:

    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.
    That is what was happening (though Base was inheriting from a third class,
    which is what was inheriting from Catalyst::Controller, same end result
    though). As the other class didn't use create_action, everything worked with
    things ordered so FormFu gets the call.

    On Monday 23 February 2009, Byron Young wrote:

    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.
    Thanks.

    It does seem somewhat awkward, as you'd have to do the same thing for every
    function. (Though it's much cleaner than the equivalent in C++, which is the
    other language I have to use regularly).

    Maybe there's something in Moose that would do it, but I haven't finished
    wrapping my head around Moose yet.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphtml-formfu @
categoriesperl, catalyst
postedFeb 22, '09 at 10:07p
activeFeb 26, '09 at 1:07a
posts5
users3
websitemetacpan.org...

People

Translate

site design / logo © 2022 Grokbase