Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use Mojolicious::Lite;
- use Mojo::UserAgent;
- use Mojo::IOLoop;
- use Data::Dumper;
- # Documentation browser under "/perldoc"
- plugin 'PODRenderer';
- my @url_lst = (
- 'https://stackoverflow.com/questions/1607904/vim-deleting-from-current-position-until-a-space',
- 'https://stackoverflow.com/questions/7409134/english-mnemonics-to-vims-shortcuts?noredirect=1&lq=1',
- 'https://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers?rq=1',
- 'https://stackoverflow.com/questions/327411/how-do-you-prefer-to-switch-between-buffers-in-vim?noredirect=1&lq=1',
- 'https://stackoverflow.com/questions/105721/how-do-i-move-to-end-of-line-in-vim?rq=1',
- 'https://stackoverflow.com/questions/235839/indent-multiple-lines-quickly-in-vi?rq=1',
- 'https://stackoverflow.com/questions/2332340/indenting-a-bunch-of-lines-in-vim?noredirect=1&lq=1',
- 'https://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting?rq=1',
- 'https://stackoverflow.com/questions/14863315/highlight-searches-in-vim-but-not-substitutions?noredirect=1&lq=1',
- 'https://stackoverflow.com/questions/1497958/how-do-i-use-vim-registers?rq=1',
- );
- my @req_lst;
- my $ua = Mojo::UserAgent->new;
- Mojo::IOLoop->singleton->recurring(5 => sub {
- my $j = 0;
- #foreach my $j (0..2) {
- foreach my $i (0..4) {
- $req_lst[$i] = $ua->get_p($url_lst[$i+($j*5)]);
- print Dumper($url_lst[$i+($j*5)]);
- }
- Mojo::Promise->all($req_lst[0], $req_lst[1], $req_lst[2], $req_lst[3], $req_lst[4])->then(sub {
- my (@lst) = @_;
- #print Dumper(@lst);
- })->wait;
- #}
- }
- );
- get '/' => sub {
- my $c = shift;
- $c->render(template => 'index');
- };
- app->start;
- __DATA__
- @@ index.html.ep
- % layout 'default';
- % title 'Welcome';
- <h1>Welcome to the Mojolicious real-time web framework!</h1>
- To learn more, you can browse through the documentation
- <%= link_to 'here' => '/perldoc' %>.
- @@ layouts/default.html.ep
- <!DOCTYPE html>
- <html>
- <head><title><%= title %></title></head>
- <body><%= content %></body>
- </html>
Add Comment
Please, Sign In to add comment