AnyEvent recursive blocking wait with Plack
Marc Lehmann
schmorp at schmorp.de
Thu Mar 8 09:11:44 CET 2012
On Wed, Mar 07, 2012 at 10:14:02PM -0800, Mike Schilli <anyevent at perlmeister.com> wrote:
> This raises an interesting question: In order to make a web application
> truly portable between different web servers (as Plack strives to do),
Yes, if Plack strives to do that, then it has to think about all of these
things. If the lowest common denominator does not allow it, then Plack can't
implement it.
If not, then that's the extra value Plack delivers - somebody investing a
lot oft ime in classifying all these servers and extracting the one common
behaviour - much like AnyEvent.
> Say, my web app does a server-server-request. If I'm running it in
> Plack/apache/mod_perl, I need to use synchronous methods (LWP::UserAgent
> et al) and if I'm running in an event-based framework like
> AnyEvent::HTTPD, I need to use event-based methods (AnyEvent::HTTP et
> al).
Well, if the Anyevent::HTTPD handler is the only one allowing that then
you are in trouble. If it's a standard feature supported everywehre,
then enjoy - if it's not documented well, you could always ask the Plack
author.
> Plack does in fact report to the web app if it's running on a synchronous or
> asynchronous 'platform', but is there a standardized way to offer the
> same functionality in a portable way (rhetorical question, I know, but
> a man can dream).
The name choice of "sync" vs. "async" is already confusing, because these are
orthogonal to both threads and events, so the question is what it even means.
If you want a portable API supported by (virtually) all webservers, then
that's CGI. And one can write longer-running servers for that using e.g.
SpeedyCGI.
If that's too sad, then I guess the best thing would be to improve Plack,
if it even needs improving. It could well be that all plack handlers
already support events, effectively.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the anyevent
mailing list