Brothers and Sisters, please consider this CGI script:
#doing stuff up here.
my $pid;
if (!defined ($pid = fork)){
DieNice("Unable to fork: $!\n");
}elsif (! $pid){
close(STDIN);
close(STDOUT);
close(STDERR);
}else{
print header,
start_html,
h2('Sending Mail...'),
"\t<meta http-equiv=\"refresh\" content=\"5; url=http://mydomain
+.com:8090\">\n",
end_html;
#Here the user is redirected.
}
while (<@to>){
chomp($_);
push @chunk, $_;
$count ++;
if ($count == 80){ #splits bcc into small chuncks
$to = join ",", @chunk;
mailout();
$count = 0;
@chunk = ();
}
}
#still doing more time consuming stuff...
I want the user to be redirected and freed from the CGI while it continues to run its code. Is this the correct way to do it? I borrowed this code from a usenet article but I don't fully understand it. Can someone please explain how this works and if it's correct?
Thank you,
Neil Watson
watson-wilson.ca
-
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.
|