perlquestion
neilwatson
Brothers and Sisters, please consider this CGI script:
<p>
<code>
#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...
</code>
<p>
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?
<p>
Thank you,
<p>
Neil Watson<br>
<a href="http://watson-wilson.ca">watson-wilson.ca</a>