Parse::OldCopec64 - ``Cortext Perl Code 64'' serialization format
use Parse::OldCopec64;
$my_data = [ [ [ 1, 2, {} ], { 0=>"acd", 2=>"abc" }, [], { 1=>2 } ], 0 ];
$encoded = perl_to_copec64($my_data);
$decoded = copec64_to_perl($encoded);
# $encoded contains solid string 2202402300100n0000100o0003003200300XD6P0 # 100m0000300X9sO0100o0002003100100o0000100n0000100m000 # $decoded is a copy (clone) of $my_data
use Data::NeatDump; print dump($my_data, $encoded, $decoded);
Transfering perl data from one environment to another may require encoding perl structure to string and then decoding this string to the source perl structure.
This module introduces string format, suitable for any imaginable transfer, named ``Cortext Perl Code 64''.
This module can be used for cloning perl structures by encoding with the following decoding.
The character set of encoded string contains 64 characters: * digits = 10 characters * english letters 26+26 = 52 characters * underscore and minus signs = 2 characters
So, every encoded character has 6-bit information entropy.
Currently supported only simple perl structures, recursively including SCALAR, ARRAY, HASH references and scalars. No loops (self references) allowed.
The encode functions suppose all internal scalars are defined. Undefined values are substituted by empty string (with warning).
The functions suppose the characters in perl scalars have 8-bit length (256 characters in charset).
Currently encoded string is one very long line. One can think to insert new-line every 64 characters to get shorter lines.
Note, if several perl structures are passed, the encoded string will contain all them (one after another).
Note, if given string includes several perl structures (one after another), they all will be returned, when called in array context.