0

Using the Catalyst::Controller::FormBuilder module to handle forms in a Catalyst application.

The documentation says you can set the form_path like this:

form_path => File::Spec->catfile( $c->config->{home}, 'root', 'forms' ),

But the call to config() in my application is at the top level of the base module. Therefore, $c is undefined. So I can't call $c->config->{home}.

What is the proper way to configure form_path please?

  • `AppName->path_to(qw/root forms/)`? – jrockway Oct 23 '09 at 06:35
  • Thanks Jonathon, good answer. This works: form_path => File::Spec->catfile(AppName->path_to(qw'etc forms')), I moved the forms, templates, and config to etc out of root. I found that I could get copies of templates etc by going to http://example.com/forms/search/page.fb for example. I didn't like that, so I cleared the stuff out of root so that doesn't happen any more. – fred nerk Oct 23 '09 at 10:39

1 Answers1

0

You should be able to access configuration values that have already been set from your application's main module using the __PACKAGE__->config hash. Example: __PACKAGE__->config->{home} or __PACKAGE__->config->{'Controller::FormBuilder'}->{form_path}.

If you're trying to set the FormBuilder configuration in your applications main module, you should be able to use the code provided in the documentation and just replace $c->config->{home} with __PACKAGE__->config->{home}. I think they might have even made a mistake by not doing it this way, but I'm not sure.

neodon
  • 58
  • 4