* Paul LeoNerd Evans <leon...@leonerd.org.uk> [2013-05-23 23:15]:
> The whole module would work easily as well given any other type of
> object with this API, including anything that is actually synchronous,
> such as a tiny wrapper around LWP:
>
>  package LWP::FutureReturning;
>  use base qw( LWP::UserAgent );
>  use Future;
>  sub request {
>    my $self = shift;
>    return Future->new->done( $self->SUPER::request( @_ ) );
>  }
>
> Hey presto - have I just invented a PSGI-alike API for writing
> webservices / things that use web clients, that can work
> synchronously, or asynchronously using IO::Async, POE, AnyEvent,
> hardcoded poll(), etc...?

That’s just what futures are for, I think? As in, they abstract the
sync/async control flow out of the code. And you’re just putting that
on top of one common HTTP client API pattern. It seems like discovery
rather than invention to me.

Naming-wise I’d emphasise futures rather than IO::Async, natch.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to