On 24/03/2011 02:39, Peter Scott wrote:
On Tue, 22 Mar 2011 13:41:59 -0700, Randal L. Schwartz wrote:
"Peter" == Peter Scott<pe...@psdt.com> writes:
my $s = Streamer->new;
my $app = sub {
return sub {
$s->open_fh;
my $writer = shift->(
[ 200, [ "Content-type" => "text/plain" ], $s ] );
};
};
Peter> As it stands, this doesn't make sense because nothing happens to
$writer; Peter> so why create it?
I presume you're objecting to the explicit $writer. Certainly, the
value of $writer is also the return value of the inner subroutine, so
that *is* something that could be noted:
Right, the superfluous naming of $writer leads to a lot of head-
scratching. Best guess (if this is an accurate post of the code), that
there was originally some debugging/logging code in there before a
"return $writer" that got taken out. Although I supposed that the paste
was incomplete. Either way, a giant red herring.
For those that overlooked the post, the OP did attribute the source:
On 18/03/2011 21:08, shawn wilson wrote:
this is where this comes from:
http://www.samuelkaufman.com/blog/2011/03/16/streaming-with-plack-take-2/
Which is take 2 of a blog entry by Samuel Kaufman. The original is here:
<http://www.samuelkaufman.com/blog/2011/03/15/simple-streaming-test-server-with-plack/>
which is pretty poor code (although the author does say "The previous
code sample sucked for numerous reasons") not least because of the
wrapping and lack of indents. But it does explain the purpose of $writer.
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/