Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Fastcgi, howto deal with exit?

by horshack (Acolyte)
on Aug 12, 2006 at 13:57 UTC ( [id://567032]=perlquestion: print w/replies, xml ) Need Help??

horshack has asked for the wisdom of the Perl Monks concerning the following question:

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;

Replies are listed 'Best First'.
Re: Fastcgi, howto deal with exit?
by Fletch (Bishop) on Aug 12, 2006 at 14:06 UTC

    You don't want to exit, you want to return from the serve method so you go through the while loop again to process the next request.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found