Catalyst with HTML::FormHandler

A

Akhor

Hi,

I'm new to Catalyst and and trying to build a simple form.

In the Catalyst controller Users.pm I've added an 'use
MyApp::UserInterface::Form::User', however it can not find this file.
Meaning that it's not in the INC path.

Obviously I could push this directory on to the INC stack, but none of
the examples that I've seen have had to do this. What is the proper
way to go about this?



Below is an example of the directory structure.

MyApp/UserInterface/Controller
MyApp/UserInterface/Controller/Admin
MyApp/UserInterface/Controller/Admin/Users.pm
MyApp/UserInterface/Form
MyApp/UserInterface/Form/User.pm
MyApp/UserInterface/Model
MyApp/UserInterface/Schema
MyApp/UserInterface/View
 
J

Jim Gibson

Akhor said:
Hi,

I'm new to Catalyst and and trying to build a simple form.

In the Catalyst controller Users.pm I've added an 'use
MyApp::UserInterface::Form::User', however it can not find this file.
Meaning that it's not in the INC path.

Obviously I could push this directory on to the INC stack, but none of
the examples that I've seen have had to do this. What is the proper
way to go about this?

The normal way is to use a 'use lib LIST;' statement to push extra
directories onto @INC. Another common way is to use the PERL5LIB
environment variable to do the same thing.

See:

perldoc lib
perldoc perlrun (and search for 'PERL5LIB')
 
A

Akhor

That's a strange directory structure for a Catalyst app. Is your
Form::User class a Model, a View, or a Controller - and why isn't it
under one of those directories?

I suspect that Catalyst isn't finding your classes simply because they
aren't where they're supposed to be. :-(

Did you use the script/myapp_create.pl helper script to create these
classes? You should, at least while you're getting started.

For a good intro to Catalyst, have a look at:

<http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::02_Catalys...>

sherm--

I know it seems like a weird structure, due to having the extra
Directory for "Form". However it's all as done as per the
HTML::Formhandler docs.

http://search.cpan.org/~zarquon/Cat...l/Tutorial/09_AdvancedCRUD/09_FormHandler.pod

Anyhow, I just pushed it onto the INC stack and it now works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top