In a previous Blog post (-R/G2SW), “-GMIS Jimis Optimize Update + GroupBySeg/+ Copy AddByCopy, etc.”, we mentioned “RegisterAct: This time, due to the deployment of a new -gwa2 project, it is required to transfer multi-byte non-ASCII character data in -PHP and -Perl. Thus, -Base62X was recommended, and the work of Base62X in Perl was put on schedule. After two weekend experiments, the first version of Base62X in Perl was completed. Below are some of the usage details, which can also be found at -github -wadelau, or directly access -base62X.
1. Base62X. PM for OOP
use Base62x; my $base62x = Base62x->new(); My $STR = "Hello World! \ n "; my $encoded = $base62x->encode($str); $str = $base62x->decode($encoded);
At the beginning of the Perl program, base62X.pm is introduced, and the corresponding object instance is generated, which is encoded and decoded by calling the encode/decode method of the instance. It is interlinked with other versions of Base62X, and achieves secure data exchange across programming languages and runtime environments. Like other versions of Base62X, the Perl version also implements methods for digital base conversion and ASCII shortcuts. Such as,
my $i = 100;
# treas $i as base 10 and transform it into Base62x
my $numInBase62x = $base62x->encode($i, 10);
# try to decode a Base62x num into base 10
$i = $base62x->decode($numInBase62x, 10);
OOP call mode, suitable for repeated calls within the cycle of the use of the scenario, because in the instantiation, the initialization of the environment variable and save the subsequent repeated actions. .
Base62X. PM for functional programming
In addition to OOP-style writing, base62X.pm also provides invocation methods for functional programming, listed below.
use Base62x qw (base62x_encode base62x_decode); My $STR = "Hello World! \ n "; my $encoded = base62x_encode($str); $str = base62x_decode($encoded);
Functional programming is suitable for use scenarios that are up and running once. The detailed implementation can refer to the code of base62X. PM. .
Base62X is available in programming languages including C, Java, PHP, JavaScript, Perl. There are also two implementations of JavaScript, base62X.class.js and NPM base62X.
Base62x: An alternative approach to Base64 for only-alphanumeric characters in output. Base62x is an non-symbolic Base64 encoding scheme. It can be used safely in computer file systems, programming languages for data exchange, internet communication systems, And is an ideal substitute and successor of many variants of Base64 Encoding scheme. Base62X is an unsigned Base64 encoding scheme. It can be safely used in computer file system, programming language data exchange and Internet communication system, and it is an ideal substitute and successor of various BASE64 encoding schemes.
-R/J2SL