Created
June 16, 2016 15:35
-
-
Save mlbright/d5ae15881b9e244b3427dbd52aaf9dcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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