Skip to content

Instantly share code, notes, and snippets.

@mpapec
Created July 29, 2016 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpapec/c857fb3f8c472300bfae906377acca0b to your computer and use it in GitHub Desktop.
Save mpapec/c857fb3f8c472300bfae906377acca0b to your computer and use it in GitHub Desktop.
$ENV{MOJO_USERAGENT_DEBUG} =1;
use Mojo::UserAgent;
use Mojo::IOLoop;
my $ua = Mojo::UserAgent->new;
Mojo::IOLoop->delay(
sub {
my $delay = shift;
$ua->get("mojolicious.org" => $delay->begin);
},
sub {
my ($delay, $mojo) = @_;
say $mojo->res->dom->at("title")->text;
}
)->wait;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment