[Catalyst] subrefs in Formbuilder plugin configuration file?

Nate Wiger nwiger at scea.com
Tue Oct 24 18:53:12 BST 2006


John Napiorkowski wrote:
> Hi,
> 
> In some of the Formbuilder documentation for the
> configuration file I get the impression that a
> subroutine or subref can be called.  I get this from
> looking at the documentation for:
> "http://search.cpan.org/~nwiger/CGI-FormBuilder-3.0401/lib/CGI/FormBuilder/Source/File.pm"
> 
> There is an example configuration file and the
> following lines:
> 
> # custom options and sorting sub
> state:
>   options:  \&getstates
>   sortopts: \&sortstates
> 
> Has anyone been able to make this work?  Or was this
> example just a work in progress?

The problem is these are called in the wrong caller() from w/i Catalyst. 
  These work outside Catalyst. I don't believe there's a patch/fix 
currently, but you can use them within your Catalyst controller by 
calling $c->form:

    sub something : Form {
        # ...
        $c->form->field(name => 'states',
                        options => \&get_states,
                        validate => \&check_states);
    }

If you have a fix, I'll gladly apply it.

-Nate (FB Author)




More information about the Catalyst mailing list