Hi,

Reference: CGI or CGI::Fast (Thanks again for all the replies :)).

I've just begun to get a little hang of FastCGI via CGI::Fast. I wasn't used to persistence so the starting part was hard for me. I also found that my existing plain CGI code broke when I tried to convert some of it to run on FastCGI, as part of my exploration.

I've a little question at this toying stage and would like to seek your advice.

I'm wondering if it's better to have a FastCGI-aware main (dispatch) script that distributes the real work to modules, or have individual FastCGI-aware scripts that run independently?

Here's an outline of the two approaches:

Approach 1: Have a main script (e.g. main.fcgi) that distributes work +to modules #!/usr/local/bin/perl -T use Module1; use Module2; use Module3; code to initialise variables while (my $q = new CGI::Fast) { code to distribute job to Module1, Module2 or Module3 } Approach 2: Three FastCGI-aware scripts named module1.fcgi (functional +ly equivalent to Module1), module2.fcgi (functionally equivalent to M +odule2) and module3.fcgi (functionally equivalent to Module3). Each o +f these scripts have more or less the same structure: #!/usr/local/bin/perl -T code to initialise variables while (my $q = new CGI::Fast) { code to run }

Which of these is the better approach with respect to FastCGI?

Thanks for reading and I look forward to your replies!


In reply to Question on design for FastCGI 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.