Yevgeny Simkin
Yevgeny Simkin

Reputation: 28349

Is it possible to print from a perl CGI before the process exits?

I have a perl CGI that needs to report some information back to the browser before it goes into a really lengthy process that frequently takes several minutes.

Currently I print the message but it doesn't show up till the entire process exits.

So, my question is:

Is it possible to get the message back to browser mid stream and if not

how do I spawn off a separate process to handle the lengthy bit, so that I can exit out of the initial process and thus have the user get the feedback they need.

The user doesn't need to be notified when the lengthy process is completed, so, I'm fine with quitting as long as the server keeps chugging at it.

Upvotes: 1

Views: 281

Answers (1)

Quentin
Quentin

Reputation: 943510

# Tell Perl not to buffer our output
$| = 1;

Upvotes: 1

Related Questions