On Mar 22, 2011 4:43 PM, "Randal L. Schwartz" <mer...@stonehenge.com> 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:
>
> my $whatever_writer_was = $app->(somearg_for_that_inner_shift);
>
> This looks like the PSGI interface.  Would have been nice to spell that
> out too, since there's a wealth of info on that already.
>
> --

Yes, it would appear that there was much more to this than I originally
suspected. It would seek that there is probably plack::builder and:
builder {
mount "/whatever" => $app;
}

And maybe more. Either way this was a good for a reference (sorta, kinda, ah
maybe not even that :) ). But, I did learn some cool stuff here (I think). I
got working what I wanted to get working and am now looking at ae::redis to
stream when I want.

I should probably go back at some point and make sure I know the basics.
However, for now, getting this stuff to work is more funner.

I learned a new way to use shift here (or probably any function that uses
$_) and I have (sorta learned about closures.

Now, I'm pretty sure that what was being shifted was a method probably $req
= Plack::Request->($env); and $req was being or gets passed from builder.

I might be new here but I think this is getting ot and I've been told that
plack is a month or so from 'supported' so I'll go now. Thank yall for the
help.

Reply via email to