man OSSP::uuid (Fonctions bibliothèques) - OSSP uuid Perl Binding
NAME
OSSP::uuid - OSSP uuid Perl Binding
DESCRIPTION
OSSP uuid is a ISO-C:1999 application programming interface (API) and corresponding command line interface (CLI) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique Identifier (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 languages ISO-:1998, Perl:5 and PHP:4/5. 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-STYLE API
The TIE-style API is a functionality-reduced wrapper around the OO-style API and intended for very high-level convenience programming:
OO-STYLE API
The OO-style API is a wrapper around the C-style API and intended for high-level regular programming.
Additionally, the strings CW"v1", CW"v3", CW"v4", CW"v5" and CW"mc" can be used in CW$mode and the strings CW"bin", CW"str", and CW"txt" can be used for CW$fmt.
C-STYLE API
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.
Additionally, the following constants are exported for use in CW$rc, CW$mode, CW$fmt and CW$ver:
CWUUID_VERSION, CWUUID_LEN_BIN, CWUUID_LEN_STR, CWUUID_RC_OK, CWUUID_RC_ARG, CWUUID_RC_MEM, CWUUID_RC_SYS, CWUUID_RC_INT, CWUUID_RC_IMP, CWUUID_MAKE_V1, CWUUID_MAKE_V3, CWUUID_MAKE_V4, CWUUID_MAKE_V5, CWUUID_MAKE_MC, CWUUID_FMT_BIN, CWUUID_FMT_STR, CWUUID_FMT_TXT.
EXAMPLES
The following two examples create the version 3 UUID CW02d9e6d5-9467-382e-8f9b-9300a64ac3cd, both via the OO-style and the C-style API. Error handling is omitted here for easier reading, but has to be added for production-quality code.
# TIE-style API (very high-level) use OSSP::uuid; tie my $uuid, 'OSSP::uuid::tie'; $uuid = [ "v1" ]; print "UUIDs: $uuid, $uuid, $uuid\n"; $uuid = [ "v3", "ns:URL", "http://www.ossp.org/" ]; print "UUIDs: $uuid, $uuid, $uuid\n"; untie $uuid;
# OO-style API (high-level) use OSSP::uuid; my $uuid = new OSSP::uuid; my $uuid_ns = new OSSP::uuid; $uuid_ns->load("ns:URL"); $uuid->make("v3", $uuid_ns, "http://www.ossp.org/"); undef $uuid_ns; my $str = $uuid->export("str"); undef $uuid; print "$str\n";
# C-style API (low-level) use OSSP::uuid qw(:all); my $uuid; uuid_create($uuid); my $uuid_ns; uuid_create($uuid_ns); uuid_load($uuid_ns, "ns:URL"); uuid_make($uuid, UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/"); uuid_destroy($uuid_ns); my $str; uuid_export($uuid, UUID_FMT_STR, $str, undef); uuid_destroy($uuid); print "$str\n";
SEE ALSO
HISTORY
The Perl binding OSSP::uuid to OSSP uuid was implemented in November 2004 by Ralf S. Engelschall <rse@engelschall.com>.