I want to convert a cgi-app to fast-cgi, but there are lots of exit-statements deep in the code. This makes fast-cgi start the whole programm from the very beginning. Some kind of MyModule::exit would be possible, but what should MyModule::exit do? This is testcode I wrote to check it:
#!/usr/bin/perl use CGI::Fast qw(:standard); our $COUNTER = 0; while ( my $wwwform = CGI::Fast->new() ) { my $dinner = Dinner->new($wwwform); $dinner->serve( $COUNTER++ ); } # Now the stuff long existing... package Dinner; use CGI::Fast qw(:standard); sub new { my ( $class, $wwwform ) = @_; bless { wwwform => $wwwform }, $class; } sub serve { my ( $self, $counter ) = @_; print header, start_html('Fast CGI Test'); printf "It's %s<br />", scalar localtime; print "Counter is $counter<br />"; print end_html; # BAD! But in several parts of code... # Fastcgi-mainprogramm exits and starts to run on next # request from the very beginning, loading tons of modules # etc. exit; # Dinner::Base::exit() # ???? } 1;

In reply to Fastcgi, howto deal with exit? by horshack

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.