cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to use CURLOPT_DEBUGFUNCTION with Perl

From: Jan Theofel <theofel_at_etes.de>
Date: Fri, 21 May 2004 11:45:59 +0200

Hello,

can someone tell me how to use the CURLOPT_DEBUGFUNCTION option from libcurl
in Perl?

In google and the other documentation I don't find an answer to this
question. So here's what I tried to find how it works:

(debug is my own debug function which reports to a file)

[...]
sub curl_debug {
  my @args = @_;

  &debug(2**11, "curl_debug", "init", join("//", @args), __LINE__);
}
[...]
&debug(2**4, "ar-export.pl", "main", "Setting cURL options", __LINE__);
$curl->setopt(CURLOPT_DEBUGFUNCTION, \&curl_debug);
$curl->setopt(CURLOPT_URL, 'ftp://sftp.adress-research.de/' . $uploadfilenamebase);
$curl->setopt(CURLOPT_USERPWD, 'culpa:Mai2004!');
$curl->setopt(CURLOPT_UPLOAD, 1);
$curl->setopt(CURLOPT_HEADER, 0);
$curl->setopt(CURLOPT_FTP_USE_EPSV, 0);
$curl->setopt(CURLOPT_FTP_SSL, 1);
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 0);
$curl->setopt(CURLOPT_INFILE, $fh_in);
$curl->setopt(CURLOPT_INFILESIZE, $filesize);
$curl->setopt(CURLOPT_VERBOSE, 1);
$curl->setopt(CURLINFO_NONE, 1);

&debug(2**4, "ar-export.pl", "main", "Run cURL", __LINE__);
if ($curl->perform() != 0)
{
  &debug(2**0, "ar-export.pl", "main", "ERROR: UPLOAD FAILED", __LINE__);
  &debug(2**0, "ar-export.pl", "main", "$curl->errbuf", __LINE__);
};
[...]

This results in a segmentation fault when running $curl->perform().

Thanks for your help in advance!

Jan

-- 
Jan Theofel                              Fon:  +49 (7 11) 48 90 83 - 0
ETES - EDV-Systemhaus GbR                Fax:  +49 (7 11) 48 90 83 - 50
Libanonstrasse 58 A * D-70184 Stuttgart  Web: http://www.etes.de
Received on 2004-05-21