NAME

Mojo::Pua - HTTP Client + Evo::Promises

VERSION

version 0.007

SYNOPSIS

Mojo::Pua inherits all methods from Mojo::UserAgent but returns Mojo::Promise object for each request

use Evo 'Mojo::Pua';
my $ua = Mojo::Pua->new();

$ua->get("http://alexbyk.com/")

  ->then(sub($res) { say $res->dom->at('title') })

  ->catch(sub($err) { say "ERR: $err"; say $err->res->body if $err->res; })

  ->finally(sub { Mojo::IOLoop->stop; });

Mojo::IOLoop->start;

DESCRIPTION

!!!ATTENTION This is first temporary release. Use it on your own risk.

This module is based on Mojo::UserAgent and allows you to use promises (Evo::Promise)

functions

PUA

A single instance of Mojo::Pua.

use Evo 'Mojo::Pua PUA';
PUA->get('http://mail.ru')->then(sub {...});

SEE ALSO

Mojo::UserAgent Mojo::Promise https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise

AUTHOR

alexbyk <alexbyk.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by alexbyk.

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