A simple async-download tool written by mojo and anyevent.Maybe u can download file by Mojo::UserAgent,but sometimes if you feel lazy ,you can try this module.
my $url = 'http://dldir1.qq.com/qqfile/QQforMac/QQ_V3.0.2.dmg'; my $d = Mojo::Downloader->new; $d->set_max_currency(5); # set this,every time download will be limited 5 files for ( 1 .. 50) { my $file = "/tmp/macqq_" . $_ . ".dmg"; $d->download( $url, $file ); } $d->cv->recv; # download 1 file $d->download($url,$file)->recv; # customize your own downloader $d->on( download => sub { my ($ua,$tx,$file,$options) = @_; # do some stuff here },` );
Copyright (C) <2014>, <niumang>.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
# niumang // vim: ts=4 sw=4 expandtab # TODO - Edit.
To install Mojo::Downloader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Downloader
CPAN shell
perl -MCPAN -e shell install Mojo::Downloader
For more information on module installation, please visit the detailed CPAN module installation guide.