The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Acme::CPANModules::UUID - Modules that can generate immutable universally unique identifier (UUIDs)

VERSION

This document describes version 0.001 of Acme::CPANModules::UUID (from Perl distribution Acme-CPANModules-UUID), released on 2020-12-22.

DESCRIPTION

UUIDs are 128-bit numbers that can be used as permanent IDs or keys in databases. There are 5 "versions" of UUID, each might be more suitable than others in specific cases. Version 1 (v1) UUIDs are generated from a time and a node ID (usually the MAC address); version 2 (v2) UUIDs from an identifier (group/user ID), a time, and a node ID; version 4 (v4) UUIDs from a random/pseudo-random number; version 3 (v3) UUIDs from hashing a namespace using MD5; version 5 (v5) from hashing a namespace using SHA-1.

Data::UUID should be your first choice,

ACME::CPANMODULES FEATURE COMPARISON MATRIX

 +--------------+-----------+-----------+-----------+-----------+-----------+-------+-------+----------------------+
 | module       | create_v1 | create_v2 | create_v3 | create_v4 | create_v5 | is_pp | is_xs | v4_secure_random *1) |
 +--------------+-----------+-----------+-----------+-----------+-----------+-------+-------+----------------------+
 | Data::UUID   | yes       | yes       | no        | no        | no        | no    | yes   | N/A                  |
 | UUID::Tiny   | yes       | no        | yes       | yes       | yes       | yes   | no    | no                   |
 | UUID::Random | no        | no        | no        | yes       | no        | yes   | no    | no                   |
 +--------------+-----------+-----------+-----------+-----------+-----------+-------+-------+----------------------+

Notes:

1. v4_secure_random: Whether the module uses cryptographically secure pseudo-random number generator for v4 UUIDs

ACME::MODULES ENTRIES

  • Data::UUID

    This module creates v1 and v2 UUIDs. Depending on the OS, for MAC address, it usually uses a hash of hostname instead. This module is XS, so performance is good. If you cannot use an XS module, try UUID::Tiny instead.

    The benchmark code creates 1000 v1 string UUIDs.

  • UUID::Tiny

    This module should be your go-to choice if you cannot use an XS module.

    To create a cryptographically secure random (v4) UUIDs, use UUID::Tiny::Patch::UseMRS.

    The benchmark code creates 1000 v1 string UUIDs.

    See also: Types::UUID which is a type library that uses Data::UUID as the backend.

  • UUID::Random

    This module simply uses 32 calls to Perl's rand() to construct each random hexadecimal digits of the UUID. Not really recommended, but it's dead simple.

    To create a cryptographically secure random UUIDs, use UUID::Random::Patch::UseMRS.

    The benchmark code creates 1000 v1 string UUIDs.

FAQ

What are ways to use this module?

Aside from reading it, you can install all the listed modules using cpanmodules:

    % cpanmodules ls-entries UUID | cpanm -n

or Acme::CM::Get:

    % perl -MAcme::CM::Get=UUID -E'say $_->{module} for @{ $LIST->{entries} }' | cpanm -n

This module contains benchmark instructions. You can run a benchmark for some/all the modules listed in this Acme::CPANModules module using bencher:

    % bencher --cpanmodules-module UUID

This module also helps lcpan produce a more meaningful result for lcpan related-mods when it comes to finding related modules for the modules listed in this Acme::CPANModules module.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Acme-CPANModules-UUID.

SOURCE

Source repository is at https://github.com/perlancar/perl-Acme-CPANModules-UUID.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-Acme-CPANModules-UUID/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Acme::CPANModules - about the Acme::CPANModules namespace

cpanmodules - CLI tool to let you browse/view the lists

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by perlancar@cpan.org.

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