Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re^3: CGI Cookies by dsheroh
in thread CGI Cookies by Trihedralguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found