1uuid(3)               User Contributed Perl Documentation              uuid(3)
2
3
4

NAME

6       OSSP::uuid - OSSP uuid Perl Binding
7

DESCRIPTION

9       OSSP uuid is a ISO-C:1999 application programming interface (API) and
10       corresponding command line interface (CLI) for the generation of DCE
11       1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique
12       Identifier (UUID). It supports DCE 1.1 variant UUIDs of version 1 (time
13       and node based), version 3 (name based, MD5), version 4 (random number
14       based) and version 5 (name based, SHA-1). Additional API bindings are
15       provided for the languages ISO-C++:1998, Perl:5 and PHP:4/5. Optional
16       backward compatibility exists for the ISO-C DCE-1.1 and Perl Data::UUID
17       APIs.
18
19       OSSP::uuid is the Perl binding to the OSSP uuid API.  Three variants
20       are provided:
21
22   TIE-STYLE API
23       The TIE-style API is a functionality-reduced wrapper around the OO-
24       style API and intended for very high-level convenience programming:
25
26       "use OSSP::uuid;"
27       tie" my $uuid, 'OSSP::uuid::tie', $mode, ...;"
28       "$uuid = [ $mode, ... ];"
29       "print "UUID=$uuid\n";"
30       "untie $uuid;"
31
32   OO-STYLE API
33       The OO-style API is a wrapper around the C-style API and intended for
34       high-level regular programming.
35
36       "use OSSP::uuid;"
37       "my $uuid = "new" OSSP::uuid;"
38       "$uuid->"load"($name);"
39       "$uuid->"make"($mode, ...);"
40       "$result = $uuid->"isnil"();"
41       "$result = $uuid->"compare"($uuid2);"
42       "$uuid->"import"($fmt, $data_ptr);"
43       "$data_ptr = $uuid->"export"($fmt);"
44       "[(]$str[, $rc)] = $uuid->"error"();"
45       "$ver = $uuid->"version"();"
46       "undef $uuid;"
47
48       Additionally, the strings "v1", "v3", "v4", "v5" and "mc" can be used
49       in $mode and the strings "bin", "str", and "txt" can be used for $fmt.
50
51   C-STYLE API
52       The C-style API is a direct mapping of the OSSP uuid ISO-C API to Perl
53       and is intended for low-level programming. See uuid(3) for a
54       description of the functions and their expected arguments.
55
56       "use OSSP::uuid qw(:all);"
57       "my $uuid; $rc = "uuid_create"($uuid);"
58       "$rc = "uuid_load"($uuid, $name);"
59       "$rc = "uuid_make"($uuid, $mode, ...);"
60       "$rc = "uuid_isnil"($uuid, $result);"
61       "$rc = "uuid_compare"($uuid, $uuid2, $result);"
62       "$rc = "uuid_import"($uuid, $fmt, $data_ptr, $data_len);"
63       "$rc = "uuid_export"($uuid, $fmt, $data_ptr, $data_len);"
64       "$str = "uuid_error"($rc);"
65       "$ver = "uuid_version"();"
66       "$rc = "uuid_destroy"($uuid);"
67
68       Additionally, the following constants are exported for use in $rc,
69       $mode, $fmt and $ver:
70
71       "UUID_VERSION", "UUID_LEN_BIN", "UUID_LEN_STR", "UUID_RC_OK",
72       "UUID_RC_ARG", "UUID_RC_MEM", "UUID_RC_SYS", "UUID_RC_INT",
73       "UUID_RC_IMP", "UUID_MAKE_V1", "UUID_MAKE_V3", "UUID_MAKE_V4",
74       "UUID_MAKE_V5", "UUID_MAKE_MC", "UUID_FMT_BIN", "UUID_FMT_STR",
75       "UUID_FMT_SIV", "UUID_FMT_TXT".
76

EXAMPLES

78       The following two examples create the version 3 UUID
79       "02d9e6d5-9467-382e-8f9b-9300a64ac3cd", both via the OO-style and the
80       C-style API. Error handling is omitted here for easier reading, but has
81       to be added for production-quality code.
82
83         #   TIE-style API (very high-level)
84         use OSSP::uuid;
85         tie my $uuid, 'OSSP::uuid::tie';
86         $uuid = [ "v1" ];
87         print "UUIDs: $uuid, $uuid, $uuid\n";
88         $uuid = [ "v3", "ns:URL", "http://www.ossp.org/" ];
89         print "UUIDs: $uuid, $uuid, $uuid\n";
90         untie $uuid;
91
92         #   OO-style API (high-level)
93         use OSSP::uuid;
94         my $uuid    = new OSSP::uuid;
95         my $uuid_ns = new OSSP::uuid;
96         $uuid_ns->load("ns:URL");
97         $uuid->make("v3", $uuid_ns, "http://www.ossp.org/");
98         undef $uuid_ns;
99         my $str = $uuid->export("str");
100         undef $uuid;
101         print "$str\n";
102
103         #   C-style API (low-level)
104         use OSSP::uuid qw(:all);
105         my $uuid;    uuid_create($uuid);
106         my $uuid_ns; uuid_create($uuid_ns);
107         uuid_load($uuid_ns, "ns:URL");
108         uuid_make($uuid, UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
109         uuid_destroy($uuid_ns);
110         my $str; uuid_export($uuid, UUID_FMT_STR, $str, undef);
111         uuid_destroy($uuid);
112         print "$str\n";
113

SEE ALSO

115       uuid(1), uuid-config(1), uuid(3).
116

HISTORY

118       The Perl binding OSSP::uuid to OSSP uuid was implemented in November
119       2004 by Ralf S. Engelschall <rse@engelschall.com>.
120
121
122
123perl v5.32.0                      2020-07-29                           uuid(3)
Impressum