cURL / Mailing Lists / curl-library / Single Mail


Re: Perl interface broken with curl 7.7

From: Daniel Stenberg <>
Date: Fri, 30 Mar 2001 09:14:37 +0200 (MET DST)

On Thu, 29 Mar 2001, Forrest Cahoon wrote:

> I just got the latest stable curl sources from the website, and noticed
> that the Curl::easy perl interface is now broken.

Yes, we're aware of that. It was been fixed in the CVS version.

> On a marginally-related note, I've been thinking of working on my own
> perl interface to libcurl, to use a more OO paradigm. My basic idea is
> pretty simple:
> $curl = Curl::OO->new(big ol' hash of setopt values);
> $curl->perform;

What would the function return? Wouldn't it return this data in an array? Or
would it depend on the options? If it would return the data, we'd need
separate functions for upload/download since it uploading would need a
different paradigm.

> The real reason I want to do this is I may have a need to get the
> progress function callback working in perl ... and of course, I'd like to
> be able to write a progress function _in_ perl.

I can't but agree that it would be cool enough.

> I've been poring over "perldoc perlcall" and I've written enough XS code
> that it actually makes some sense to me (which is scary). I believe a
> wrapper function could be written in XS code that can be passed the name
> of a perl routine to be called for the progress function. The input and
> output callbacks seem more problematic, because of filehandle issues, but
> might be possible to handle in the same way.

The file handle is just a pointer you set with CURLOPT_FILE. It can be
anything you want, as you write the write function you decide how to treat
the pointer (nothing in libcurl will ever touch it). In the FAQ there's a
tiny example showing how that can be used to download a file into a single
large chunk of memory.

> It wouldn't really be necessary to go OO to get the callbacks to work,
> but it seems like the right approach to me, because of the opportunity to
> hide ugliness inside an object (and the callbacks will involve some
> ugliness!).

Personally, I'm a fan of such OO'ness you're describing. You might like a
previous discussion we've had in this subject, archived here:

> I think I'm just going to start hacking on this, but suggestions are most
> welcome.

I was contacted by another person who might be interested in helping out as
well. I'll let him introduce himself if he'd decide to actually do it.

  Daniel Stenberg -- curl project maintainer --
Curl-library mailing list
Received on 2001-03-30