(Perl) Workaround for the deprecated Crypt2.Encode method
Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.) Note: This example requires Chilkat v11.0.0 or greater.
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);
|