OSSP OSSP::uuid is a ISO-C:1999 application programming interface (API) and corresponding command line
interface (CLI) for the generation of RFC 9562, ISO/IEC 11578:1996 and IETF RFC-4122 compliant
UniversallyUniqueIdentifier (UUID). It supports DCE 1.1 variant UUIDs of version 1 (time and node
based), version 3 (name based, MD5), version 4 (random number based) and version 5 (name based, SHA-1).
Additional API bindings are provided for the Perl:5 language. Optional backward compatibility exists for
the ISO-C DCE-1.1 and Perl Data::UUID APIs.
OSSP::uuid is the Perl binding to the OSSP uuid API. Three variants are provided:
TIE-STYLEAPI
The TIE-style API is a functionality-reduced wrapper around the OO-style API and intended for very high-
level convenience programming:
use OSSP::uuid;
tiemy$uuid,'OSSP::uuid::tie',$mode,...;
$uuid = [ $mode, ... ];
print "UUID=$uuid\n";
untie $uuid;
OO-STYLEAPI
The OO-style API is a wrapper around the C-style API and intended for high-level regular programming.
use OSSP::uuid;
my$uuid=newOSSP::uuid;$uuid->load($name);$uuid->make($mode,...);$result=$uuid->isnil();$result=$uuid->compare($uuid2);$uuid->import($fmt,$data_ptr);$data_ptr=$uuid->export($fmt);[(]$str[,$rc)]=$uuid->error();$ver=$uuid->version();
undef $uuid;
Additionally, the strings "v1", "v3", "v4", "v5", "v6", "v7", and "mc" can be used in $mode and the
strings "bin", "str", and "txt"$fmt.
C-STYLEAPI
The C-style API is a direct mapping of the OSSP uuid ISO-C API to Perl and is intended for low-level
programming. See uuid(3) for a description of the functions and their expected arguments.
use OSSP::uuid qw(:all);
my$uuid;$rc=uuid_create($uuid);$rc=uuid_load($uuid,$name);$rc=uuid_make($uuid,$mode,...);$rc=uuid_isnil($uuid,$result);$rc=uuid_ismax($uuid,$result);$rc=uuid_compare($uuid,$uuid2,$result);$rc=uuid_import($uuid,$fmt,$data_ptr,$data_len);$rc=uuid_export($uuid,$fmt,$data_ptr,$data_len);$str=uuid_error($rc);$ver=uuid_version();$rc=uuid_destroy($uuid);
Additionally, the following constants are exported for use in $rc, $mode, $fmt, and $ver: UUID_VERSION,
UUID_LEN_BIN, UUID_LEN_STR, UUID_RC_OK, UUID_RC_ARG, UUID_RC_MEM, UUID_RC_SYS, UUID_RC_INT, UUID_RC_IMP,
UUID_MAKE_V1, UUID_MAKE_V3, UUID_MAKE_V4, UUID_MAKE_V5, UUID_MAKE_MC, UUID_MAKE_V6, UUID_MAKE_V7,
UUID_FMT_BIN, UUID_FMT_STR, UUID_FMT_SIV, UUID_FMT_TXT.