[Catalyst] expand CGI::FormBuilder

Juan Camacho juan at camachofamily.com
Sat Nov 24 14:05:07 GMT 2007

On Nov 23, 2007 4:04 AM, Jonathan Rockway <jon at jrock.us> wrote:

> 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(@_) }
>    1;
> 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.

Yep, that should do it although _create_formbuilder is private and
undocumented :) Also, I haven't documented the C::C::F::Action class
or the 'action' config parameter mostly because I'm not sure I am
going to keep the Action implementation around. I use C::C::F::Action
subclasses in my own applications, so I *probably* will.

Matt's suggestion is good and makes the above unnecessary for this
case. Simply add support for
$config->{Controller::FormBuilder}{formbuilder_class} =
'My::Own::FormBuilder'.  This will help with the simple cases where
you just want to swap CGI::FormBuilder with a subclass or an adapter
pattern class instead.


More information about the Catalyst mailing list