Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by alain_desilets (Beadle)
on May 06, 2012 at 03:13 UTC ( #969103=note: print w/ replies, xml ) Need Help??


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

For me, the html contains the generated html

Strange. Maybe Windows deals differently than Unix with reading files that are still open for writing? I'm on Windows.


Comment on Re^6: CGI::Session keeps re-using same session ID
Re^7: CGI::Session keeps re-using same session ID
by Anonymous Monk on May 06, 2012 at 22:06 UTC

    Strange. Maybe Windows deals differently than Unix with reading files that are still open for writing? I'm on Windows.

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

      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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://969103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-07-26 18:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (178 votes), past polls