As I begin my first major CGI undertaking, I find myself making lots of little CGI programs which I am passing parameters to and from and feel like there is probably a more elegant, and secure, way to do the whole thing as one CGI program with subroutines. Example: currently I have a database, users can select an item to change it. So I have the database CGI, then then CGI file for asking what changes are needed for a particular entry, and then another CGI file to submit the changes. This could all be one file I feel, but I have questions about how to do this:

-can a single CGI script produce several HTML pages-say output one, wait 30 seconds and then output another. If this is possible, how do I do it?

-If put all my files together into subroutines of one big program, every time I execute it I need some mechanism to decide which subroutine to go to....do I pass some parameter like subroutine=editentry and then have some sort of PERL if statement to go to the proper subroutine? If I do this than I need to also know how to pass parameters from an HTML form which are not being entered by the user. How do I do this?

Any help would be great! Thanks!

Jeff


In reply to CGI: Make one big program or lots of little ones? by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.