Skip Menu |

This queue is for tickets about the HTML-Mason CPAN distribution.

Report information
The Basics
Id: 38924
Status: resolved
Priority: 0/
Queue: HTML-Mason

People
Owner: Nobody in particular
Requestors: autarch [...] urth.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.43



Subject: fix for flush_buffer infinite loop
Date: Tue, 2 Sep 2008 16:19:36 -0500 (CDT)
To: bug-html-mason [...] rt.cpan.org
From: Dave Rolsky <autarch [...] urth.org>
Show quoted text
---------- Forwarded message ---------- Date: Sat, 26 Jul 2008 14:09:59 -0400 From: Frédéric Brière <fbriere@fbriere.net> To: Dave Rolsky <autarch@urth.org> Cc: 436507@bugs.debian.org Subject: Re: [Mason-devel] Bug#436507: libhtml-mason-perl: autoflush breaks store modifier On Fri, Jul 25, 2008 at 11:45:43AM -0400, Frédéric Brière wrote:
> I'd probably do more harm than good by putting my greasy hands in there.
Actually, once I managed to wrap my head around some of the inner workings, the fix was quite simple. It's basically an extension of r3752. (It's just that it took me an obscene amount of time to realize that the default out_method was only set for subrequests. Until then, I couldn't figure out why there wasn't an infinite loop between flush_buffer and out_method. Silly me.) Anyway, here it is. Notice that scomp() was also affected by this bug, so -- nyah! :) If I'm not mistaken (and I very well could be), this doesn't fix the issue for subrequests, or at least those called with out_method. (Without out_method, they will merely pile up their output over the parent's STACK_BUFFER, right?) IOW, if you set out_method, and then scomp() a component that makes a subrequest that happens to call flush_buffer(), things will get screwy. I think. -- I knew I'd hate COBOL the moment I saw they'd used "perform" instead of "do". -- Larry Wall on a not-so-popular programming language

Message body is not shown because sender requested not to inline it.

Hello, Could you please apply the patch and release a new version? It fixes another issue with flush. $m->flush_buffer in deep components may flush buffers even if we're in $m->content call. A new test file attached. On Tue Sep 02 17:20:03 2008, autarch@urth.org wrote: Show quoted text
> > ---------- Forwarded message ---------- > Date: Sat, 26 Jul 2008 14:09:59 -0400 > From: Frédéric Brière <fbriere@fbriere.net> > To: Dave Rolsky <autarch@urth.org> > Cc: 436507@bugs.debian.org > Subject: Re: [Mason-devel] Bug#436507: libhtml-mason-perl: autoflush breaks > store modifier > > On Fri, Jul 25, 2008 at 11:45:43AM -0400, Frédéric Brière wrote:
> > I'd probably do more harm than good by putting my greasy hands in there.
> > Actually, once I managed to wrap my head around some of the inner > workings, the fix was quite simple. It's basically an extension of > r3752. > > (It's just that it took me an obscene amount of time to realize that the > default out_method was only set for subrequests. Until then, I couldn't > figure out why there wasn't an infinite loop between flush_buffer and > out_method. Silly me.) > > Anyway, here it is. Notice that scomp() was also affected by this bug, > so -- nyah! :) > > > If I'm not mistaken (and I very well could be), this doesn't fix the > issue for subrequests, or at least those called with out_method. > (Without out_method, they will merely pile up their output over the > parent's STACK_BUFFER, right?) > > IOW, if you set out_method, and then scomp() a component that makes a > subrequest that happens to call flush_buffer(), things will get screwy. > I think. > > > -- > I knew I'd hate COBOL the moment I saw they'd used "perform" instead of > "do". > -- Larry Wall on a not-so-popular programming language
-- Best regards, Ruslan.
#!/usr/bin/perl -w use strict; use File::Spec; use HTML::Mason::Tests; my $tests = make_tests(); $tests->run; sub make_tests { my $group = HTML::Mason::Tests->tests_class->new( name => 'flush-in-content', description => 'recursive calls with $m->content' ); #------------------------------------------------------------ $group->add_support( path => '/widget', component => <<'EOF', <div>\ <% $content |n %>\ </div>\ <%init> my $content = $m->content; </%init> EOF ); #------------------------------------------------------------ $group->add_support( path => '/block', component => <<'EOF', <block></block>\ % $m->flush_buffer; EOF ); #------------------------------------------------------------ $group->add_test( name => 'flush-in-deep-content', description => 'make sure flush does not flush when we are in $m->content()', component => <<'EOF', <&| widget &><&| widget &><& block &></&></&> EOF expect => <<'EOF', <div><div><block></block></div></div> EOF ); return $group; }