Hi, That's nothing todo with mod_perl. When doing things like this I'm using the browsers DHTML-capabilities, loading only the non-static parts. The only thing mod_perl can help you is to remember which values you've send to the client and not sending them if they have not changed but this includes a more complex design.
When you decide to use DHTML you have to possibilities to load values dynamically. 1) A hidden Frame which simply holds JavaScript-Code somethig like this: ----------------------8<---------------------- <script> // frame 0 is your visible frame parent.frames[0].redrawVal('price1','$5.00'); parent.frames[0].redrawVal('price2','$4.00'); parent.frames[0].redrawVal('price3','$3.00'); // reload every 5 seconds window.setTimeout( 'location.reload(true);', 5000 ); </script> ----------------------8<---------------------- And your visible page holds something like this: ----------------------8<---------------------- <script> function redrawVal(id,value) { document.getElementById(id).innerHTML=value; } </script> .... <div id="price1">4.90</div> ----------------------8<---------------------- This should work on every new generation browser like Mozilla, IE, Opera, Konqueror 2) You could use the Browser builtin XML-Requests. With this solution you avoid using a hidden-frame. ----------------------8<---------------------- // test for IE var isIE = ( navigator.appName.indexOf( "Internet Explorer" ) != -1 )?true:false; // IE needs a global var to hold the request object // the other solution it to use a closure var objXMLHTTP; function reloadValues() { if( isIE ) { // OH it's IE we are using an ActiveX-Component window.objXMLHTTP = new ActiveXObject('Microsoft.XMLHTTP'); window.objXMLHTTP.open('POST',"/mod_perl/getMyData",false); // which function is called when sate changes window.objXMLHTTP.onreadystatechange = XMLIECallBack; // write your param-string instead of null window.objXMLHTTP.send( null ); } else { var xmlrequest = new XMLHttpRequest(); xmlrequest.onload = XMLMozillaCallBack; // write your param-string instead of null xmlrequest.send( null ); } } function XMLIECallBack() { // when state is 4 the XML is loaded completly // and we can parse it. if( window.objXMLHTTP.readyState == 4 ) { var xmlDoc = new ActiveXObject( 'Microsoft.XMLDOM' ); xmlDoc.loadXML( objXMLHTTP.responseText ); redrawVals(xmlDoc); } } function XMLMozillaCallBack( e ) { var parser = new DOMParser(); redrawVals( parser.parseFromString(e.target.responseText,"text/xml") ); } function redrawVals( xmlDoc ) { // get the nodes var val_nodes = xmlDoc.getElementsByTagName('value'); // loop through the nodes and redraw the fields defined for( var i = 0; i < val_nodes.length; i++ ) { redrawVal(val_nodes[i].getAttribute('id'),val_nodes[i].getAttribute('value')); } // reload everything in 5 seconds window.setTimeout( "reloadValues()", 5000 ); } // like solution 1 function redrawVal(id,value) { document.getElementById(id).innerHTML=value; } ----------------------8<---------------------- ----------------------8<---------------------- <response> <value id="price1" value="$5.00"/> <value id="price2" value="$4.00"/> <value id="price3" value="$3.00"/> </response> ----------------------8<---------------------- This only works on > IE 5.5 and Mozilla based browsers. Still when working in a defined environment like I do, I prefer this solution, because it gives you a maximum of flexibility. Indeed this solution is similar to a webservice but many times smaller. The code above may not work because of typos, ... still you should get the clue. I've used both solutions in many different projects and they're working. In my opinion using DTHML is the best solution to address your needs. The drawback is that you have to deal with browser pecularities, and you have learn a great bunch of JavaScript and when using solution 2 you'll also have to learn XML. Hope that helped Tom On Tue, 2003-09-23 at 09:18, parvez mohamed wrote: > Hi, > I am building a application in which i need to > display live stock market prices with out the user > presing the refresh button. Its similer to live game > scores. > > I have tryed using something like this simple script : > > #!/usr/bin/perl > chop ($current_date = `/bin/date`); > print "Content-type: text/html", "\n\n"; > print "<HTML>", "\n"; > print "<HEAD><TITLE>Effects of Browser > Caching</TITLE></HEAD>", "\n"; > print "<META HTTP-EQUIV='Refresh' CONTENT=1>"; > print "<BODY><H1>", $current_date, "</H1>", "\n"; > print "</BODY></HTML>", "\n"; > > This refreshes the whole page > i need to refresh only some fields not the whole page > I can use floating frames for this but i dont think > its good solution > > Is there any thing in mod_perl to address this issue > I mean if u feel thre is some other better solution > please do direct me to the right place. I am quite a > new commer to the perl world. > > Thanks in advance, > Parvez > > > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design software > http://sitebuilder.yahoo.com -- \\\||/// \\ - - // ( @ @ ) -oOo--( )--oOo---------------------------------------------------------- ___ ___ tom schindl o __ / / / innovative medientechnik planung AG / /\/\/ / / /__/ / __ mailto:[EMAIL PROTECTED] / / / / /_/ / / /___/ http://www.impire.de / voice:+43(512)34193432,fax:+43(512)34193420 Eduard-Bodem-Gasse 6, A-6020 Innsbruck, Austria, Software Engineering ------------------------------------------------------------------------