I am not sure if I understand well the whole design, but in the name
of brainstorming - one idea for you to consider: make the
$response_starter a parameter to the new call. This way you could get
rid of the ->prepare method. I for one like when objects are created
ready-to-work.
--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/
Thanks for your input. Making the response starter a param to new()
would not get rid of the prepare() call, because with PSGI you cannot
get a "writer object" until after you have sent the headers... and
setting headers in the new() call is not mandatory (see
Plack::Response).I suppose in the name of making the interface more
intuitive, the name of prepare() could be changed to something such as
"send_headers()" or "finalize_headers()". Would that help?
At the least I should probably change prepare() so that it returns the
object:
my $resp = Plack::Response::Streamable->new(200)-
>prepare($response_starter);
$resp->write('Hello world!');
The other reason that I designed it this way was so it could be a drop-
in replacement for Plack::Response (thus I named the module
"Streamable" and not "Streaming").