Skip to content

Instantly share code, notes, and snippets.

@mlbright
Created June 16, 2016 15:35
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 mlbright/d5ae15881b9e244b3427dbd52aaf9dcb to your computer and use it in GitHub Desktop.
Save mlbright/d5ae15881b9e244b3427dbd52aaf9dcb to your computer and use it in GitHub Desktop.
use Mojolicious::Lite;
# Search MetaCPAN for "mojolicious"
get '/' => sub {
my $c = shift;
$c->ua->get(
'api.metacpan.org/v0/module/_search?q=mojolicious' => sub {
my ( $ua, $tx ) = @_;
sleep(3);
$c->app->log->debug(
"after 3s. " . scalar( @{ $tx->res->json->{hits}{hits} } ) );
}
);
$c->render( text => "event received" );
};
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment