LWP::Protocol::Net::Curl - the power of libcurl in the palm of your hands!
#!/usr/bin/env perl; use common::sense; use LWP::Protocol::Net::Curl; use WWW::Mechanize; ...
fork()multiple downloader instances
By default, every protocol listed in that array will be implemented via LWP::Protocol::Net::Curl. It is possible to import only specific protocols:
use LWP::Protocol::Net::Curl takeover => 0; LWP::Protocol::implementor(https => 'LWP::Protocol::Net::Curl');
The default value of
takeover option is true, resulting in exactly the same behavior as in:
use LWP::Protocol::Net::Curl takeover => 0; LWP::Protocol::implementor($_ => 'LWP::Protocol::Net::Curl') for @LWP::Protocol::Net::Curl::implements;
Default curl_easy_setopt() options can be set during initialization:
use LWP::Protocol::Net::Curl encoding => '', # use HTTP compression by default referer => 'http://google.com/', verbose => 1; # make libcurl print lots of stuff to STDERR
Options set this way have the lowest precedence. For instance, if WWW::Mechanize sets the Referer: by it's own, the value you defined above won't be used.
Quickly enable libcurl verbose mode via
PERL5OPT environment variable:
PERL5OPT=-MLWP::Protocol::Net::Curl=verbose,1 perl your-script.pl
Bonus: it works even if you don't include the
use LWP::Protocol::Net::Curl line!
Stanislaw Pusep <email@example.com>
This software is copyright (c) 2012 by Stanislaw Pusep.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.