0.003 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
GPL-1.0-or-later - GNU General Public License v1.0 or laterUUID4::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.
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.
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.