Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: CGI Cookies

by dsheroh (Monsignor)
on Feb 18, 2008 at 18:14 UTC ( [id://668630]=note: print w/replies, xml ) Need Help??


in reply to Re^2: CGI Cookies
in thread CGI Cookies

You probably would be best off using a single CGI program to handle all stages. Aside from your original cookie issue, it cuts down on duplicated code (e.g., initialization) by allowing all stages to reference the same routines and also makes it much easier to repeat stages if needed. (User ended up at stage 3, but some of the required information is missing? Just call the stage 2 sub and send them back to fix it.)

Personally, I tend to use a CGI::Application-style approach to do this, with the code for each different page of the application in a separate module, then a very small .cgi which just loads up those modules and dispatches calls to them based on the request's specified action (CGI::Application calls it a "runmode"). Others are very fond of Catalyst or other frameworks, but I'm not familiar enough with any of them to describe how they function.

Oh, and I just reread your post and picked up on something I missed earlier... Are you under the impression that "1 CGI script = 1 page"? That is most definitely not the case. The same CGI can produce an unlimited number of distinct pages. Having a single CGI program which produces 6 different pages (selecting based on the input received - or selecting randomly, for that matter) and saving each one's input to the database after each step is no harder (and probably actually easier) than writing 6 separate CGIs which each produce one page.

Replies are listed 'Best First'.
Re^4: CGI Cookies
by Trihedralguy (Pilgrim) on Feb 18, 2008 at 19:18 UTC
    CGI::Application isn't an option right now, I haven't been able to pick it up yet.

    I have in the past made a lot of applications with very minimal "number of pages". I was just hoping to make this one a bit more structured. Having 1000+ lines of code in one application starts to get very confusing. In the last form application I made, I had less than 3 CGI scripts. But it was a considerably less amount of data being filled out.

    I think what I might end up doing is just calling a second page like I describe above, where I just say "You are being logged in...One moment." (Or Something). Pass them the cookie and the continue on the process. Well see, but thanks for all the suggestions!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://668630]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-03-29 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found