[Catalyst] expand CGI::FormBuilder

Jonathan Rockway jon at jrock.us
Fri Nov 23 09:04:47 GMT 2007

On Fri, 2007-11-23 at 09:43 +0100, Felix Antonius Wilhelm Ostmann wrote:
> Yes, but i dont understand the system catalyst load a class ... at which 
> point i must told C::C::FormBuilder to load MyApp::FormBuilder and not 
> CGI::FormBuilder?!?!
> Must i rewrite the hole C::C::FormBuilder::Action? Or what is to do? :-/

FormBuilder::Action builds the CGI::Formbuilder instance like this:

   sub _create_formbuilder {
       my $self = shift;
       return CGI::FormBuilder->new( @_ );

So what you need to do is do something like:

   package MyApp::FormBuilder::Action;
   use base 'Catalyst::Controller::FormBuilder::Action::TT'; # or Mason etc.
   sub _create_formbuilder { shift; return MyApp::FormBuilder->new(@_) }

Then configure Catalyst::Controller::FormBuilder to use it:

   $config->{Controller::FormBuilder}{action} = 'MyApp::FormBuilder::Action';

That should do it.  This is totally untested though, so good luck.

Jonathan Rockway

More information about the Catalyst mailing list