I have this error in my script, but everything seems to be in order:
Undefined subroutine &WWW::Curl::Form::curl_formaddfile caclled at /home/script.pm line 107
lines around 107 line looks like this:
my $curlf = WWW::Curl::Form->new;
$curlf->curl_formaddfile($nfo, 'nfo', "multipart/form-data"); #107 line
$curlf->curl_formaddfile($torrent, 'file', "multipart/form-data");
$curlf->curl_formadd("name", $name);
$curlf->curl_formadd("type", $category);
$curlf->curl_formadd("descr", $$descr_txt);
$curlf->curl_formadd("anonymous", "1");
$curlf->curl_formadd("samehash", "1");
my $curl = new WWW::Curl::Easy;
my $response_details;
# windows check
if($os eq "windows"){
$curl->setopt(CURLOPT_WRITEFUNCTION, \&curl_write_data);
}else{
open (my $response_details_raw, ">", \$response_details);
$curl->setopt(CURLOPT_WRITEDATA,$response_details_raw);
}
my @curl_headers=('Expect:');
$curl->setopt(CURLOPT_HTTPHEADER, \@curl_headers);
$curl->setopt(CURLOPT_FOLLOWLOCATION, 1);
$curl->setopt(CURLOPT_RETURNTRANSFER, 1);
$curl->setopt(CURLOPT_SSL_VERIFYPEER, 1);
$curl->setopt(CURLOPT_SSL_VERIFYHOST, 1);
$curl->setopt(CURLOPT_TIMEOUT, 60);
$curl->setopt(CURLOPT_VERBOSE, 0);
$curl->setopt(CURLOPT_COOKIE, $cookie_glabella);
$curl->setopt(CURLOPT_REFERER, $upload_referer);
$curl->setopt(CURLOPT_HTTPPOST, $curlf);
$nfo prints out as /home/file.nfo
after that goes WWW::Curl::Easy and it does not work as it can not POST from this data.
What could be the problem?
For the doc, the method
curl_formaddfileis listed in theCompatibilitysection (Seems to be working.).Maybe you have a newer module so you should use the method
formaddfileinsteadSee below an example from the doc: