UUID4::Tiny - Cryptographically secure v4 UUIDs for Linux x64
version 0.003
use UUID4::Tiny qw/ create_uuid create_uuid_string is_uuid_string is_uuid4_string string_to_uuid uuid_to_string /; my $uuid = create_uuid; my $uuid_string = create_uuid_string; $uuid = string_to_uuid $uuid_string; $uuid_string = uuid_to_string $uuid; if ( is_uuid4_string $uuid_string ) { ... }
Uses the Linux getrandom() system call to generate a version 4 UUID.
Requires Linux kernel 3.17 or newer for getrandom().
my $uuid = create_uuid;
Gets a series of 16 random bytes via the getrandom() system call and sets the UUID4 version and variant on those bytes. Dies with a message containing the errno if the call to getrandom() fails.
my $uuid_string = uuid_to_string( create_uuid );
Converts a 16 byte UUID to a canonical 8-4-4-4-12 format UUID string.
Calling this function on a string that is already a UUID string will return the string unmodified, and raise a warning.
Calling this function on a reference is almost certainly not what you want, as the function would naively try to unpack the stringified reference, e.g. ARRAY(0xdeadbeef1234), into a UUID string. For this reason, the function will croak if its input is a reference.
ARRAY(0xdeadbeef1234)
my $uuid_string = create_uuid_string;
Shortcut for uuid_to_string called on create_uuid.
my $uuid = string_to_uuid( $uuid_string );
Converts a canonical 8-4-4-4-12 format UUID string to a 16 byte UUID.
if ( is_uuid_string( $input ) ) { ... }
Checks if the input matches the canonical 8-4-4-4-12 format.
if ( is_uuid4_string( $input ) ) { ... }
Similar to is_uuid_string, additionaly checking that the variant and version are correct for UUID v4.
UUID::URandom - A portable UUID v4 generator using Crypt::URandom.
UUID::Tiny - Creates version 1, 3, 4 and 5 UUIDs (not cryptographically strong due to rand() usage).
CV-Library <cvlibrary@cpan.org>
This software is copyright (c) 2019 by CV-Library.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install UUID4::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UUID4::Tiny
CPAN shell
perl -MCPAN -e shell install UUID4::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.