cURL / Mailing Lists / curl-library / Single Mail


Re: Perl Interface broken with curl 7.7

From: Sander van Zoest <>
Date: Thu, 29 Mar 2001 23:51:27 -0800 (PST)

> 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;
> undef $curl; # automatically cleans up with an appropriate DESTROY

The easiest way to do this would simply put some wrapper code in
perl around the XS routines. I think we should just replace the old
with a new OO Perl 5ish interface.

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

I definately am interested in helping out on this, but I have other
things on my plate as well. The hard part would be to come up with
an OO design that is perlish enough and would be the most natural
to get used to.

It might make sense to mimic the LWP::UserAgent/Request interface.

use Curl::UserAgent qw(:constants);

my $curl = Curl::UserAgent->new( agent => "Mozarella/3.2",
                                 keepalive => 1,
                                 follow-redirects => 1,
                                 keepcookies => 1);

# get a Curl::Request object.
my $req = curl->get("");
print $req->headers();

# get a Curl::Cookie object
my $session = req->get_cookie("SESSION_ID");

# print the body
if( $req->status eq OK) {
  while(<$req>) { print; }
} else {

Anyways just some random ideas.


Sander van Zoest                                
High Geek                               
Curl-library mailing list
Received on 2001-03-30