This is a clever trick i do to control the ending 
of a browser load for a page. With this subroutine, 
i created a javascript and perl web chat engine. 
As soon as a remote  visitor adds text to the chat room,
this subroutine completes it's wait pattern which closes 
the load to the client computer.

All that's needed is a simple 
<body onLoad="refreshChatWindow()"> 
in the html page and BAM! 
you have a fully shared text object with any browser.


If this is confusing try this,
Bob and Jane in chat room.
Bob's browser loads the chatyes.gif 
from your perl script. The perl script pauses to finish the 
image download until Jane adds text to the chat room. 
Once Jane hits submit button; Bob's page is reloaded. 
This low-tech solution has proven to be very effective.

Pasteing the entire script would require me making an 
unrelated custom module of mine portable. But i think the 
gist of the idea is here in this subroutine.

See this subroutine in action at chat.metasphere.net
sub ipImage{ print "Content-type:image/gif\n\n"; $content = "chatyes.gif"; open (FILE,"$content"); while ($line = <FILE>){ print "$line"; }close FILE; for($x=0;$x<30;$x++){ if (-e "webchat/$iplogin.t"){ unlink("webchat/$iplogin.t"); $x=1000; exit; } sleep(1); } }#################################### end ipImage

In reply to A Socket Streamer Subroutine by true

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.