MIME::Base64::URLSafe3pm
Perl version of python's url-safe base64 codec
Usage
use MIME::Base64::URLSafe;$encoded = urlsafe_b64encode('Alladdin: open sesame');$decoded = urlsafe_b64decode($encoded);
Overview
This module is a perl version of python's URL-safe base64 encoder / decoder.
When embedding binary data in URL, it is preferable to use base64 encoding. However, two characters ('+' and '/') used in the standard base64 encoding have special meanings in URLs, often leading to re-encoding with URL-encoding, or worse, interoperability problems.
To overcome the problem, the module provides a variation of base64 codec compatible with python's urlsafe_b64encode / urlsafe_b64decode.
Modification rules from base64:
use '-' and '_' instead of '+' and '/'no line feedsno trailing equals (=)
The following functions are provided:
urlsafe_b64encode($str)urlsafe_b64decode($str)
If you prefer not to import these routines to your namespace, you can call them as:
use MIME::Base64::URLSafe ();$encoded = MIME::Base64::URLSafe::encode($decoded);$decoded = MIME::Base64::URLSafe::decode($encoded);
Releases
9 releases since Debian 5.0 (Lenny); the text changed 3 times.