[Catalyst] Having problem with Catalyst::Controller::FormBuilder module with Catalyst 5.8

Cory Hollingsworth cory at users.sourceforge.net
Mon Nov 22 16:41:24 GMT 2010


Hello every one.

I have a couple of Catalyst based web applications which I created about 2
years ago which work with Catalyst 5.7x, Catalyst::Controller::FormBuilder
0.05, and CGI::FormBuilder 3.0501.  I would like to move these to a
Catalyst 5.8 environment.  I am expecting to have to do a little bit of
tweaking to get this to work but am hoping to avoid having to rewrite the
applications to use FormHandler.  I am running into an error right off the
bat which I cannot seem to get around.

Here is a very simple example of a Root.pm code which illustrates my problem:

<Start Perl Code>
package lookupreset::Controller::Root;
use base 'Catalyst::Controller::FormBuilder';
use Moose;
use namespace::autoclean;

BEGIN { extends 'Catalyst::Controller' }

__PACKAGE__->config(namespace => '');

sub lookup : Global Form {
        my ($self, $c) = @_;

        my $form = $self->formbuilder;
#    Do Stuff
}

sub index :Path :Args(0) {
    my ( $self, $c ) = @_;

    $c->res->redirect('lookup');
}

sub default :Path {
    my ( $self, $c ) = @_;
    $c->response->body( 'Page not found' );
    $c->response->status(404);
}

__PACKAGE__->meta->make_immutable;

1;
</End Perl Code>

I have a lookup.tt and lookup.fb file in root and root/forms respectively.
 I will not post them as I do not think they are relevant with the text of
the error message.

I receive this output from my lookupreset_server.pl process:

[error] Caught exception in lookupreset::Controller::Root->lookup "Can't
locate object method "formbuilder" via package
"lookupreset::Controller::Root" at
/home/chollingsworth/lookupreset/lookupreset/script/../lib/lookupreset/Controller/Root.pm
line 13."

Line 13 is the "my $form = $self->formbuilder;" line.  Now I understand
this is an object not found error.  What I do not understand is why it is
not finding the object with Catalyst 5.8 when the same version of the
Catalyst::Controller::FormBuilder and CGI::FormBuilder modules work with
Catalyst 5.7.

>From the debugger in the Catalyst 5.8 server it looks like this object
handling is occurring inside of the Catalyst modules and I see some
momentary activity inside of Moose.  Is Catalyst::Controller::FormBuilder
not compatible with the newer Moose based Catalyst?

Is there a way to get Catalyst::Controller::FormBuilder working in
Catalyst 5.8?

Should Catalyst::Controller::FormBuilder work in Catalyst 5.8 and there is
something peculiar to my environment?

Thank you for your patience.  Web application programming is a corner case
in my job which is one of the reasons I adopted Catalyst as a framework.

Cory




More information about the Catalyst mailing list