So how would the image be displayed if I don't flush the buffers? Simplified application is...

imageviewer.html...
    <form with play button which has play_image.html as target>
    <img xxx>
    <%perl>
    if( $m->session->{isplaying} == 1 ) {
        $m->flush_buffer();
        $m->comp('redirect', url="">     }
    </%perl>

play_image.html...
    $m->session->{isplaying} = 1;
    $m->comp('redirect', url=""

next_image.html...
    $m->session->{currentindex} = $m->session->{currentindex} + 1;   # increment the image index
    $m->comp('redirect', url="">
redirect code from Oliver...
    <%init>
    my $status = 302;
    $m->auto_send_headers(0);
    $r->headers_out->add('Location' => $url);
    $r->status($status);
    $m->clear_buffer;
    ## include status here anyway, just in case it's started working again
    $m->abort($status);
    </%init>
    <%args>
    $url    # URL to redirect to
    </%args>




John Williams wrote:
On Tue, 5 Dec 2006, Oliver Jeeves wrote:
  
Forgive me if I'm wrong, but doesn't mod_perl buffer output, and
therefore allows you to mix-and-match when you output content and headers?
    

To some extent, yes, but notice that the sample code explicitly calls
flush_buffer to output the buffer BEFORE it calls redirect which sets the
header.

<%perl>
if( $m->session->{isplaying} == 1 ) {
    $m->flush_buffer();
    $m->redirect('next_image.html');
}
</%perl>

I suspect that removing the flush_buffer will fix the problems.
AFAIK browsers never show content from a redirect unless something goes
horribly wrong.

~ John Williams


  
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to