Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/creaktive/lwp-protocol-net-curl
let's make LWP great again!
https://github.com/creaktive/lwp-protocol-net-curl
curl libcurl libwww-perl lwp perl
Last synced: 3 months ago
JSON representation
let's make LWP great again!
- Host: GitHub
- URL: https://github.com/creaktive/lwp-protocol-net-curl
- Owner: creaktive
- Created: 2012-10-24T13:37:35.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T12:01:12.000Z (over 5 years ago)
- Last Synced: 2024-10-14T02:01:15.031Z (3 months ago)
- Topics: curl, libcurl, libwww-perl, lwp, perl
- Language: Perl
- Homepage: https://metacpan.org/module/LWP::Protocol::Net::Curl
- Size: 95.7 KB
- Stars: 14
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.pod
Awesome Lists containing this project
README
=pod
=encoding UTF-8
=head1 NAME
LWP::Protocol::Net::Curl - the power of libcurl in the palm of your hands!
=head1 VERSION
version 0.026
=head1 SYNOPSIS
#!/usr/bin/env perl;
use common::sense;use LWP::Protocol::Net::Curl;
use WWW::Mechanize;...
=head1 DESCRIPTION
Drop-in replacement for L, L and their derivatives to use L as a backend.
Advantages:
=over 4
=item *
support ftp/ftps/http/https/sftp/scp protocols out-of-box (secure layer require L to be compiled with TLS/SSL/libssh2 support)
=item *
support SOCKS4/5 proxy out-of-box
=item *
connection persistence and DNS cache (independent from L)
=item *
lightning-fast L and redirection
=item *
lower CPU usage: this matters if you C multiple downloader instances
=item *
asynchronous threading via L (see F)
=item *
at last but not least: B<100% compatible> with both L and L test suites!
=back
=head1 LIBCURL INTERFACE
You may query which L protocols are implemented through L by accessing C<@LWP::Protocol::Net::Curl::implements> or C<%LWP::Protocol::Net::Curl::implements>.
By default, B listed in that array will be implemented via L.
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 C option is I, 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 L 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 STDERROr during runtime, using special HTTP headers (prefixed by C):
use LWP::Protocol::Net::Curl;
use LWP::UserAgent;my $ua = LWP::UserAgent->new;
my $res = $ua->get(
'https://metacpan.org/',
X_CurlOpt_Verbose => 1,
);Options set this way have the lowest precedence.
For instance, if L sets the I by it's own, the value you defined above won't be used.=head1 DEBUGGING
Quickly enable libcurl I mode via C environment variable:
PERL5OPT=-MLWP::Protocol::Net::Curl=verbose,1 perl your-script.pl
B it works even if you don't include the C line!
=for Pod::Coverage import
request=head1 TODO
=over 4
=item *
better implementation for non-HTTP protocols
=item *
more tests
=item *
expose the inner guts of libcurl while handling encoding/redirects internally
=item *
revise L "event loop" code
=back
=head1 BUGS
=over 4
=item *
sometimes still complains about I
=item *
in "async mode", each L instance "blocks" until all requests finish
=item *
parallel requests via L are B; consider using L if you're into event-driven parallel user agents
=item *
L support is disabled on threaded Perl builds
=back
=head1 SEE ALSO
=over 4
=item *
L - used as a reference for L implementation
=item *
L - another L reference
=item *
L - L usage reference
=item *
L - backend for this module
=item *
L - provides L-compatible API via L
=back
=head1 AUTHOR
Stanislaw Pusep
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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.=head1 CONTRIBUTORS
=for stopwords José Joaquín Atria Nick Kostyria Peter Williams
=over 4
=item *
José Joaquín Atria
=item *
Nick Kostyria
=item *
Peter Williams
=back
=cut