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

Workaround for the deprecated Crypt2.Encode method

Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.)

Chilkat Perl Downloads

Perl
use chilkat();

$crypt = chilkat::CkCrypt2->new();

$path = "c:/someDir/example.dat";

#  Such as base64, hex, hex_lower, etc.
$encoding = "base64";

#  ------------------------------------------------------------------------
#  The Encode method is deprecated:

$inData = chilkat::CkByteData->new();
$inData->loadFile($path);

$encodedBytes = $crypt->encode($inData,$encoding);

#  ------------------------------------------------------------------------
#  Workaround.
#  (Chilkat is moving away from using CkByteData)

$bd = chilkat::CkBinData->new();
$bd->LoadFile($path);

$encodedBytes = $bd->getEncoded($encoding);