in reply to WWW::Curl help

Every time I hear it has no real documentation (or documentation sucks) I wish to playfully smack that person :)

http://search.cpan.org/~szbalint/WWW-Curl-4.05/lib/WWW/Curl.pm#DOCUMENTATION

This module provides a Perl interface to libcurl. It is not intended to be a standalone module and because of this, the main libcurl documentation should be consulted for API details at http://curl.haxx.se. The documentation you're reading right now only contains the Perl specific details, some sample code and the differences between the C API and the Perl one.
So how many times have you read http://curl.haxx.se/libcurl/c/libcurl-tutorial.html?

Does anyone understand what callback functions do?
http://en.wikipedia.org/wiki/Callback_(computer_science)
http://curl.haxx.se/libcurl/c/libcurl-tutorial.html explains what libcurl callback's do.

Any clue as to how i might download a file over ftp and save it on my hard drive?
http://curl.haxx.se/lxr/source/docs/examples/ftpget.c
compare with http://search.cpan.org/src/SZBALINT/WWW-Curl-4.05/t/01basic.t

Although other "libraries" exist that will probably do what i want quicker i have to download a lot of files at a time, speed is an issue and it appears that Curl is a solution to my problem, any ideas?
You appear to very much behind the curve, after 2 days I would hire a tutor/consultant.

Replies are listed 'Best First'.
Re^2: WWW::Curl help
by bittis (Sexton) on Aug 22, 2008 at 10:38 UTC
    Easy there, no need to be so hurtfull! :P hehe

    I understand what libcurl is and what WWW::Curl is. I am also reading the tutorial you are refering to and have got something running, although not with the desired results. I ll read and see what a Callback function is in computer science. Thank you for your reply :)

    Finally, are you saying your services are up for hire? :)

      The best phrase I can think of to describe what a callback is is this well known snippet ;-) :

      Don't call us, we call you

      A callback is a subroutine that isn't called directly by some code (the caller), but given as parameter to some other code/subroutine/process (the called), which eventually calls (back) that subroutine.

      Look at sort() in perl. The comparision function you can give to sort is essentially a callback. You never call it yourself, sort calls it when it needs to. Callbacks are most commonly used in window managers where the callbacks react to asynchronous events like key presses and mouse clicks.

        best phrase

        I heard this title of a jazz song lastnight.....

        "If You See Kay"

        if ( uc( k){ \&callback }

        Oh...Fridays :-)


        I'm not really a human, but I play one on earth Remember How Lucky You Are
      :) Here's my adaptation minus the callback, untested
      #!/usr/bin/perl -T -- use strict; use warnings; use WWW::Curl 4.05; # otherwise no WRITEDATA, other bugs ... use WWW::Curl::Easy; { my $curl = WWW::Curl::Easy->new(); my $ftpfile = 'README.curl'; if( $curl ){ $curl->setopt(CURLOPT_URL, "ftp://ftp.sunet.se/pub/www/utilities/curl/README.curl"); $curl->setopt(CURLOPT_WRITEDATA,$ftpfile); $curl->setopt(CURLOPT_VERBOSE,1); my $retcode = $curl->perform(); if ($retcode != 0) { warn "An error happened: ", $curl->strerror($retcode), " ( +$retcode)\n"; warn "errbuf: ", $curl->errbuf; } # redundant since $curl goes out of scope $curl->curl_easy_cleanup; } else { warn "DARN, , WWW::Curl::Easy->new() failed"; } } __END__ # ppm install WWW::Curl # ppm install http://theoryx5.uwinnipeg.ca/ppms/WWW-Curl.ppd # http://curl.haxx.se/libcurl/c/ # http://curl.haxx.se/libcurl/c/libcurl-tutorial.html # http://curl.haxx.se/libcurl/c/curl_easy_setopt.html # http://curl.haxx.se/libcurl/c/curl_easy_perform.html # http://curl.haxx.se/lxr/source/docs/examples/ftpget.c # http://cool.haxx.se/cvs.cgi/*checkout*/curl/docs/examples/ftpget.c?r +ev=1.8&content-type=text/plain # http://cool.haxx.se/cvs.cgi/*checkout*/curl/docs/examples/ftpget.c?r +ev=HEAD&content-type=text/plain # http://search.cpan.org/src/SZBALINT/WWW-Curl-4.05/t/01basic.t