NAME

Net::Async::Webservice::Common::SyncAgentWrapper - minimal wrapper to adapt a sync UA

VERSION

version 1.0.1

DESCRIPTION

This class wraps an instance of LWP::UserAgent (or something that looks like it) to allow it to be used as if it were a Net::Async::HTTP. It is very limited at the moment, please read all of this document and, if you need more power, submit a bug request.

An instance of this class will be automatically created if you pass a LWP::UserAgent (or something that looks like it) to the constructor for a class doing Net::Async::Webservice::Common::WithUserAgent.

ATTRIBUTES

ua

The actual user agent instance.

METHODS

do_request

Delegates to $self->ua->request, and returns an immediate Future. It supports just a few of the options you can pass to the actual method in Net::Async::HTTP. These are supported:

  • request => HTTP::Request

  • host => string

  • port => int or string

  • uri => URI or string

  • method => string

  • content => string or arrayref

  • content_type => string

  • user => string

  • pass => string

  • fail_on_error => boolean

In additon, options with keys of the form SSL_* will be set via the ssl_opts method, if the underlying user agent supports it.

GET

$ua->GET( $uri, %args ) ==> $response
$ua->HEAD( $uri, %args ) ==> $response

POST

$ua->POST( $uri, $content, %args ) ==> $response

Convenient wrappers for using the GET, HEAD or POST methods with a URI object and few if any other arguments, returning a Future.

Please check the documentation of "do_request" for the values you can usefully pass in %args.

AUTHOR

Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Net-a-porter.com.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.