Skip to content

Instantly share code, notes, and snippets.

@tempire
Created March 11, 2015 22:31
Show Gist options
  • Select an option

  • Save tempire/36fa47983b4cff9a6fc0 to your computer and use it in GitHub Desktop.

Select an option

Save tempire/36fa47983b4cff9a6fc0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Mojolicious::Lite;
use POSIX 'strftime';
my $ua = Mojo::UserAgent->new;
get '/' => sub {
my $c = shift;
$c->delay(
sub {
$ua->get('https://duckduckgo.com/?q=test&format=json' => shift->begin);
},
sub {
$c->render(json => {results => pop->res->json('/AbstractURL')});
},
);
};
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment