2011-01-10 6 views
0

Ich habe diesen Fehler in meinem Skript, aber alles scheint in Ordnung zu sein:undefinierte Unterprogramm Fehler WWW unter Verwendung :: Locken :: Formular in Perl

Undefined Subroutine & WWW :: Locken :: Formular :: curl_formaddfile caclled bei /home/script.pm Linie 107

Linien um 107 sieht wie folgt aus:

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 druckt als /home/file.nfo

danach WW geht W :: Curl :: Easy und es funktioniert nicht, da es aus diesen Daten nicht senden kann. Was könnte das Problem sein?

Antwort

1

Für die doc, wobei das Verfahren curl_formaddfile ist im Compatibility Abschnitt (Seems to be working.) aufgeführt. Vielleicht haben Sie eine neuere Modul, so dass Sie die Methode formaddfile statt

unter Beispiel Siehe aus dem doc verwenden sollten:

use WWW::Curl::Form; 
    my $curlf = WWW::Curl::Form->new; 
    $curlf->formaddfile($filename, 'attachment', "multipart/form-data"); 
    $curlf->formadd("FIELDNAME", "VALUE"); 

    $curl->setopt(CURLOPT_HTTPPOST, $curlf); 
+0

Das Problem ist mein Skript ist völlig ähnlich. Ich verstehe nicht viel von PERL, aber ich habe es von allen Seiten überprüft und konnte das Problem nicht finden. Mein Code setzt sich wie in Ihrem Beispiel fort. Ich habe meinen Beitrag aktualisiert, damit Sie sehen können, dass es dasselbe ist. – Treat

+0

Sie verwenden nicht die Formaddfile-Methode. Wechsel von 'curl_formaddfile' nach' formaddfile' – ccheneson

+0

perfektionieren Sie das Beste: D – Treat

Verwandte Themen