Data-UUID-Concise
view release on metacpan or search on metacpan
Data::UUID::Concise - Encode UUIDs to be more concise or communicable
VERSION
version 0.121240
SYNOPSIS
use Data::UUID::Concise;
my $duc = Data::UUID::Concise->new();
my $encoded_uuid = $duc->encode((Data::UUID->new)->create);
my $decoded_uuid = $duc->decode('M55djt9tt4WoFaL68da9Ef');
$duc->alphabet('aaaaabcdefgh1230123');
$duc->alphabet; # 0123abcdefgh
ATTRIBUTES
alphabet
This is the collection of symbols that are used for the encoding scheme.
By default, a reasonably unambiguous set of characters is used that is
reminiscent of the base 58 scheme used by a rather prominent photo
site's URL shortener.
METHODS
encode
Encode a Data::UUID instance as a string with the appropriate set of
symbols.
decode
Decode a string with the appropriate set of symbols and return a
Data::UUID instance representing the decoded UUID.
FUNCTIONS
_normalize_alphabet
Private method. Normalize the alphabet such that it is sorted and that
all elements are distinct.
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
lib/Data/UUID/Concise.pm view on Meta::CPAN
=head1 VERSION
version 0.121240
=head1 SYNOPSIS
use Data::UUID::Concise;
my $duc = Data::UUID::Concise->new();
my $encoded_uuid = $duc->encode((Data::UUID->new)->create);
my $decoded_uuid = $duc->decode('M55djt9tt4WoFaL68da9Ef');
$duc->alphabet('aaaaabcdefgh1230123');
$duc->alphabet; # 0123abcdefgh
=head1 ATTRIBUTES
=head2 alphabet
This is the collection of symbols that are used for the encoding
scheme.
lib/Data/UUID/Concise.pm view on Meta::CPAN
=head1 METHODS
=head2 encode
Encode a Data::UUID instance as a string with the appropriate set of
symbols.
=head2 decode
Decode a string with the appropriate set of symbols and return a
Data::UUID instance representing the decoded UUID.
=head1 FUNCTIONS
=head2 _normalize_alphabet
Private method. Normalize the alphabet such that it is sorted and that
all elements are distinct.
=head1 SUPPORT
t/injective-functions.t view on Meta::CPAN
}
SKIP: {
skip
'these tests fail inconsistently based on the from_string method in Data::UUID',
scalar keys %encoded_uuids;
for my $uuid ( keys %encoded_uuids ) {
lives_ok(
sub {
my $encoded = $duc->encode( $uuid );
my $decoded = $duc->decode( $encoded );
$du->compare( $uuid, $decoded );
}
);
}
}
done_testing;
( run in 0.418 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )