Progressive display -- small hack towards it

Not ME
  • Not ME
    Not ME

    It would be way cool to be able to send the result to the web server progressively as the data is acquired; in particular, for slow running SQL query results display.

    Unfortunately, the current architecture would not allow it, I have some alternate design in preparation for it, but it's far from there yet.

    What I plan to do RSN is to be able to send the beginning of the file UP TO the first dynamic parameter to a given filehandle, so that the user sees that something's coming. This will solve problem such as users cancelling the page download earlier, and will make sites appear snappier.


    my $tmpl = HTML::Template->new(filename=>'template.html', displayto => \*STDOUT);

    What do you think?

    This is not always desirable, such as in cases where an error could occur; but then, it'd be better to display the beginning, and then have:

    <TMPL_IF error>
    <p>An error has occured!</p>
    <TMPL_LOOP results>
    <p><TMPL_VAR value></p>

    • Sam Tregar
      Sam Tregar

      The problem with this is that HTML::Template has no way to know when its ok to output a chunk of template until you actually call output().  Unless you place arbitrary restrictions - like no calling param() with the same NAME twice - I don't see how this can work.