Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^8: CGI::Session keeps re-using same session ID

by alain_desilets (Beadle)
on May 07, 2012 at 19:11 UTC ( #969314=note: print w/replies, xml ) Need Help??

in reply to Re^7: CGI::Session keeps re-using same session ID
in thread CGI::Session keeps re-using same session ID

I'm also on Windows. The code you presented finishes writing to a file, then it streams it.

Oops. Posted an older version of the code. In that older version, I was opening the HTML temp file, writing to it, then streaming the temp file. It does stream the full content, but it defeats the whole purpose, because you don't start streaming the file until the complete HTML has been printed to it.

I tried to address this issue by starting to stream the temp file right after it was opened, in the hopes that streaming from a file that is open for writing would work. In other words, I used this version of stream_dynamic_html:

sub stream_dynamic_html { my ($self) = @_; $| = 1; open TEMP_HTML_FILE, ">$temp_dynamic_html_fpath"; $self->stream_file($temp_dynamic_html_fpath, 10); my $q = $self->query(); print TEMP_HTML_FILE $q->start_html(-title => 'HTML page dynamical +ly streamed to scean'); print TEMP_HTML_FILE $q->h3('HTML page dynamically streamed to sce +an'); print TEMP_HTML_FILE $q->p("The following lines will be printed at + 1 sec interval."); for (my $ii=0; $ii<3; $ii++) { print TEMP_HTML_FILE $q->p("This is line $ii.\n"); sleep(1); } print TEMP_HTML_FILE $q->p()."\n"; print TEMP_HTML_FILE "<a href=\"$script_name?dlg=stream_dynamic_ht +ml\">Stream dynamic HTML page</a><br/>\n"; print TEMP_HTML_FILE "<a href=\"$script_name?dlg=stream_static_fil +e\">Stream static file</a><br/>\n"; print TEMP_HTML_FILE $q->end_html(); close TEMP_HTML_FILE; }

Unfortunately, this does not work, and ends up only showing a file that has the single digit 1 in it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://969314]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2018-05-26 18:36 GMT
Find Nodes?
    Voting Booth?