Hello Monks,

Today i would like to give you some first impressions of WWW::Curl::Lite.
Here are some examples to wet your appetite.

Oneliner:
perl -MWWW::Curl::Lite -e 'print WWW::Curl::Lite->get("http://files.oo +ok.de")'

The advanced interface:
#!/usr/bin/perl -w use strict; use WWW::Curl::Lite; use WWW::Curl::Lite::Request; my $request = new WWW::Curl::Lite::Request({ url => 'http://oook.de' } +); $request->useragent('curltest/0.1'); $request->postfields('test=1&curl=cool'); my $curl = new WWW::Curl::Lite; my $response = $curl->request($request); print $response->content;

The parallel interface:
#!/usr/bin/perl -w use strict; use WWW::Curl::Lite; use WWW::Curl::Lite::Request; my $request1 = new WWW::Curl::Lite::Request; $request1->url('http://oook.de'); my $request2 = new WWW::Curl::Lite::Request; $request2->url('http://files.oook.de'); my $curl = new WWW::Curl::Lite; $curl->register($request1); $curl->register($request2); my $responses = $curl->request; foreach my $response (@$responses) { print $response->content; }

Some of you may already know WWW::Curl, and how horrible it's API is.
Here is a small example that shows it.

#!/usr/bin/perl -w use strict; use WWW::Curl::Easy; my $url = 'http://oook.de'; sub header_callback { my $chunk = shift; print($chunk); return length($chunk); } + sub body_callback { my ( $chunk, $handle ) = @_; print($chunk); return length($chunk); } my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $url ); $curl->setopt( CURLOPT_HEADERFUNCTION, \&header_callback ); $curl->setopt( CURLOPT_WRITEFUNCTION, \&body_callback ); $curl->perform;
Yes, thats very similar to libcurls C API, but pure horror for most Perl hackers. :)

In the future WWW::Curl::Lite should become a better alternative to LWP.
Currently it's biggest feature is its performance, benchmarks showed that its around 30 times faster than LWP and LWP::Parallel.

I have not yet benchmarked it against HTTP::GHTTP and HTTP::MHTTP, but WWW::Curl::Lite can handle parallel downloads, so chances are very good that it will win.

WWW::Curl::Lite doesn't use the official WWW::Curl 2.0 from CPAN, instead it uses my unofficial WWW::Curl 3.0, which adds many new features, the most important one is multi support.
Next to that many things were cleaned or rewritten from scratch.

WWW::Curl::Lite and WWW::Curl 3.0 are not yet on CPAN, because of some problems with the upstream maintainer, but i hope that will change very soon.
UPDATE: Problems are solved, we are working on a release.

You would help very much by giving some productive feedback, like whats missing or what sucks.

Patches, documentation or some evil examples would be nice too!

Currently you can grab actual versions from here:
WWW::Curl::Lite
WWW::Curl

In reply to First impressions of WWW::Curl::Lite by sri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.