Not really DBI, DBD:: related, but,
You might want to try flushing at each print, which you can do by putting
$|++;
before any print statments at the top of program.
CGI might cache the output untill all processes return and then flush, by
doing this, it will flush on every print.
Also if this doesn't help,
What if you try outputting in the parent process and do the processing in
child? Also you are not checking for errors, I wonder if something is
failing.
Ilya Sterin
-----Original Message-----
From: Dexter Coelho
To: [EMAIL PROTECTED]
Sent: 03/27/2001 10:16 AM
Subject: Problem with Perl forking process
Here's the sub..Its pretty simple. Its supposed to send emails and
show
the
"Sent emails " page right away but it seems the page is being displayed
a
substantial time later after it seems the emails are sent but I'm
expecting
it to appear almost right away because of forking. It appears there's a
forking process happening.
Thanks
Dexter
sub adminsendall
{
$pid= fork();
if($pid==0)
{
my $dbh = $drh->connect( $multidbname,$dbusername,$dbpassword ) or
die
"Unable to connect to Product Category database";
$sth = $dbh->prepare("select * from members ");
$sth->execute;
my $row_hash;
$i=0;
while($row_hash = $sth->fetchrow_hashref)
{
$email= $row_hash->{email};
$firstname= $row_hash->{adminoverride};
open(MAIL,"|$mailprog -t") || die "cant open $mailprog";
print MAIL "To: $email\n";
print MAIL "From: $adminemail\n";
print MAIL "Subject: $subject\n";
print MAIL "Hi $firstname\n\n";
print MAIL $message;
close(MAIL);
$i=$i+1;
}
$sth->finish;
$dbh->disconnect;
exit;
}
else{ print $page->header;
print "<html><head><title>Online Greeting Cards</title>";
print " </head><body>";
print"<center><b>Your Emails have been sent</center></b>";
print "</body></html>";
exit;
}
}