NAME

Data::TUID - A smaller and more communicable pseudo-UUID

VERSION

version 0.0122

SYNOPSIS

use Data::TUID

        my $tuid = tuid             # Generate a TUID of (default) length 8
        $tuid = tuid length => 4    # Generate a TUID of length 4
        $tuid = Data::TUID->tuid    # Generate a TUID with the default length

        $tuid = tuid uuid => '1bf4d967-9e4c-4414-9be0-26f31c16fb53' # Generate a TUID based off of the given UUID

A sample run (length 4):

        rrry
        ggf5
        m1qb
        xczx
        pv9y

A sample run (length 8):

        5xcfw8nj
        2q255fyg
        pn3xns4k
        1xcamd3y
        eczzca9c

A sample run (no length limit):

        2kdk8wzjmfapj28cvexj6qndq7
        2tmzr1f3k46tr813dtrxx2vhkqkd
        1x3608c39mb1n726dhmxedjy72d
        pre6tg2dm37zbw9amxg2c8bghn
        3ys0kw21rmtpf54gsmnd28r99pj

DESCRIPTION

Data::TUID is a tool for creating small, communicable pseudo-unique identifiers. Essentially it will take a UUID, pass the result through Encode::Base32::Crockford, and resize accordingly (via "substr")

Although I've tried to sample the UUID evenly, this technique does not give any guarantee on uniqueness. Caveat emptor.

Finally, the result is more communicable (and smaller) due to the Crockford base-32 encoding. The Crockford technique uses:

        A case-insensitive mapping
        1 in place of '1','I', 'i', and 'L'
        0 in place of '0', 'O', and 'o'

So, given a TUID (say something a user typed in for a URL), you can translate ambiguous characters (1, I, i, L, 0, 0, and o) into to 1 and 0.

USAGE
Data::TUID->tuid( ... )
Data::TUID::tuid( ... )
tuid ...
The arguments are:

uuid The UUID to use as a basis for the TUID. If none is given, one will be generated for you

        length  The length of the TUID returned. By default 8. A length of -1 will result in the whole
                UUID being used, and a variable length TUID being returned (somewhere between 25 to 28)

SEE ALSO

Encode::Base32::Crockford

Data::UUID::LibUUID

<http://www.crockford.com/wrmg/base32.html>

ACKNOWLEDGEMENTS
AUTHOR

Robert Krimen <robertkrimen@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Robert Krimen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.