Sample code for 30+ languages & platforms
Perl Requires Chilkat v11.0.0+

Transition from Http.PFile to Http.HttpFile

Provides instructions for replacing deprecated PFile method calls with HttpFile.

Chilkat Perl Downloads

Perl
use chilkat();

$success = 0;

$http = chilkat::CkHttp->new();

$verb = "POST";
$url = "https://example.com/";
$localFilePath = "c:/temp/requestBodyContent.dat";
$contentType = "application/octet-stream";

#  ------------------------------------------------------------------------
#  The PFile method is deprecated:

# responseObj is a HttpResponse
$responseObj = $http->PFile($verb,$url,$localFilePath,$contentType,0,0);
if ($http->get_LastMethodSuccess() == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

#  ...
#  ...

#  ------------------------------------------------------------------------
#  Do the equivalent using HttpFile.
#  Your application creates a new, empty HttpResponse object which is passed 
#  in the last argument and filled upon success.

$responseOut = chilkat::CkHttpResponse->new();
$success = $http->HttpFile($verb,$url,$localFilePath,$contentType,$responseOut);
if ($success == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}