Subject: | DYNAMIC_FILE_UPLOAD = 1 in a multipart/form-data POST breaks |
DYNAMIC_FILE_UPLOAD = 1 in a multipart/form-data POST breaks
SCRIPT:
use HTTP::Request::Common;
use LWP::UserAgent;
$HTTP::Request::Common::DYNAMIC_FILE_UPLOAD = 1;
my $ulr = 'https://foo.html';
my $hash = {
'data_file' => [ '/anyfile.txt' ],
'filename' => 'anyfile.txt'
};
my $ua = LWP::UserAgent->new();
$ua->timeout(2400);
my $res = $ua->request(
POST $url, 'Content-Type' => 'form-data', Content => $hash
);
print $res->as_string;
RESULT:
500 Not a SCALAR reference
SOLUTION: ( LWP/Protocol/http.pm )
$content_ref = $$content_ref if ref($$content_ref);
change to
$content_ref = $$content_ref if
ref($content_ref) ne 'CODE' && ref($$content_ref);