head 1.16; access; symbols UUID_1_6_2:1.15 UUID_1_6_1:1.14 UUID_1_6_0:1.13 UUID_1_5_1:1.10 UUID_1_5_0:1.9 UUID_1_4_2:1.8 UUID_1_4_1:1.7 UUID_1_4_0:1.6 UUID_1_3_2:1.4 UUID_1_3_1:1.2 UUID_1_3_0:1.1; locks; strict; comment @# @; 1.16 date 2008.07.05.12.58.22; author rse; state dead; branches; next 1.15; commitid XLXN7vUmABwPcC9t; 1.15 date 2008.07.04.21.48.01; author rse; state Exp; branches; next 1.14; commitid y0hLDNAXwDqzax9t; 1.14 date 2008.01.10.14.18.49; author rse; state Exp; branches; next 1.13; commitid LqMgFGBgTR7clSMs; 1.13 date 2007.05.19.20.00.47; author rse; state Exp; branches; next 1.12; commitid qLbE5CV0mvMROzis; 1.12 date 2007.01.01.18.14.57; author rse; state Exp; branches; next 1.11; commitid jOXiIO8S8v7xFP0s; 1.11 date 2006.11.20.18.17.34; author rse; state Exp; branches; next 1.10; commitid gxjuSLMbFBr62rVr; 1.10 date 2006.07.31.12.45.09; author rse; state Exp; branches; next 1.9; commitid uBoIc6jFr8slN0Hr; 1.9 date 2006.05.11.18.42.54; author rse; state Exp; branches; next 1.8; commitid YcLYmdTCsTWunDwr; 1.8 date 2006.03.13.09.42.48; author rse; state Exp; branches; next 1.7; commitid D0QSfAAm5ajNh0pr; 1.7 date 2006.02.07.08.42.53; author rse; state Exp; branches; next 1.6; commitid k181EBCE8QfZ2Dkr; 1.6 date 2006.01.13.06.44.33; author rse; state Exp; branches; next 1.5; commitid hYfQc9JIMh4bcphr; 1.5 date 2006.01.12.20.32.43; author rse; state Exp; branches; next 1.4; commitid bgsM5SxjtMhkOlhr; 1.4 date 2005.12.06.11.52.11; author rse; state Exp; branches; next 1.3; commitid D2QvoISTKeru7ycr; 1.3 date 2005.12.06.07.38.49; author rse; state Exp; branches; next 1.2; commitid MVrbOqApuQGvIwcr; 1.2 date 2005.09.24.10.20.24; author rse; state Exp; branches; next 1.1; 1.1 date 2005.08.31.09.59.45; author rse; state Exp; branches; next ; desc @@ 1.16 log @remove OSSP uuid from CVS -- it is now versioned controlled in a Monotone repository @ text @## ## OSSP uuid - Universally Unique Identifier ## Copyright (c) 2004-2007 Ralf S. Engelschall ## Copyright (c) 2004-2007 The OSSP Project ## Copyright (c) 2004 Piotr Roszatycki ## ## This file is part of OSSP uuid, a library for the generation ## of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that ## the above copyright notice and this permission notice appear in all ## copies. ## ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ## SUCH DAMAGE. ## ## uuid_compat.pm: Data::UUID Backward Compatibility Perl API ## package Data::UUID; use 5.006; use warnings; use strict; use OSSP::uuid; use MIME::Base64 qw(); require Exporter; our @@ISA = qw(Exporter); our @@EXPORT = qw(NameSpace_DNS NameSpace_OID NameSpace_URL NameSpace_X500); our $VERSION = do { my @@v = ('1.6.2' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; sub new { my $class = shift; my $self = bless {}, $class; return $self; } sub create { my ($self) = @@_; my $uuid = OSSP::uuid->new; $uuid->make('v4'); return $uuid->export('bin'); } sub create_from_name { my ($self, $nsid, $name) = @@_; my $uuid = OSSP::uuid->new; my $nsiduuid = OSSP::uuid->new; $nsiduuid->import('bin', $nsiduuid); $uuid = OSSP::uuid->new; $uuid->make('v3', $nsiduuid, $name); return $uuid->export('bin'); } sub to_string { my ($self, $bin) = @@_; my $uuid = OSSP::uuid->new; $uuid->import('bin', $bin); return $uuid->export('str'); } sub to_hexstring { my ($self, $bin) = @@_; my $uuid = OSSP::uuid->new; $uuid->import('bin', $bin); (my $string = '0x' . $uuid->export('str')) =~ s/-//g; return $string; } sub to_b64string { my ($self, $bin) = @@_; return MIME::Base64::encode_base64($bin, ''); } sub from_string { my ($self, $str) = @@_; my $uuid = OSSP::uuid->new; $uuid->import('str', $str =~ /^0x/ ? join '-', unpack('x2 a8 a4 a4 a4 a12', $str) : $str ); return $uuid->export('bin'); } sub from_hexstring { my ($self, $str) = @@_; my $uuid = OSSP::uuid->new; $uuid->import('str', join '-', unpack('x2 a8 a4 a4 a4 a12', $str)); return $uuid->export('bin'); } sub from_b64string { my ($self, $b64) = @@_; return MIME::Base64::decode_base64($b64); } sub compare { my ($self, $bin1, $bin2) = @@_; my $uuid1 = OSSP::uuid->new; my $uuid2 = OSSP::uuid->new; $uuid1->import('bin', $bin1); $uuid2->import('bin', $bin2); return $uuid1->compare($uuid2); } my %NS = ( 'NameSpace_DNS' => 'ns:DNS', 'NameSpace_URL' => 'ns:URL', 'NameSpace_OID' => 'ns:OID', 'NameSpace_X500' => 'ns:X500', ); while (my ($k, $v) = each %NS) { no strict 'refs'; *{$k} = sub () { my $uuid = OSSP::uuid->new; $uuid->load($v); return $uuid->export('bin'); }; } sub constant { my ($self, $arg) = @@_; my $uuid = OSSP::uuid->new; $uuid->load($NS{$arg} || 'nil'); return $uuid->export('bin'); } sub create_str { my $self = shift; return $self->to_string($self->create); } sub create_hex { my $self = shift; return $self->to_hexstring($self->create); } sub create_b64 { my $self = shift; return $self->to_b64string($self->create); } sub create_from_name_str { my $self = shift; return $self->to_string($self->create_from_name(@@_)); } sub create_from_name_hex { my $self = shift; return $self->to_hexstring($self->create_from_name(@@_)); } sub create_from_name_b64 { my $self = shift; return $self->to_b64string($self->create_from_name(@@_)); } 1; @ 1.15 log @bump version before release @ text @@ 1.14 log @adjust copyright messages for 2008 and bump version in advance @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.6.1' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.13 log @bump before release @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.6.0' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.12 log @Adjust copyright messages for new year 2007. @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.5.1' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.11 log @Fix the Data::UUID::to_b64string() function of the Perl backward compatibility API: an empty string was not supplied as the EOL marker to MIME::Base64::encode_base64() and hence the returned string ended with a newline character (which in turn breaks many applications using Data::UUID). Submitted by: Piotr Roszatycki @ text @d3 2 a4 2 ## Copyright (c) 2004-2006 Ralf S. Engelschall ## Copyright (c) 2004-2006 The OSSP Project @ 1.10 log @bump before release @ text @d87 1 a87 1 return MIME::Base64::encode_base64($bin); @ 1.9 log @as we have already changes too much, switch to 1.5 now @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.5.0' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.8 log @bump version before release @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.4.2' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.7 log @bump before release @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.4.1' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.6 log @Adjust copyright messages for new year 2006. @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.4.0' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.5 log @bump up the version because of PostgreSQL bindings @ text @d3 2 a4 2 ## Copyright (c) 2004-2005 Ralf S. Engelschall ## Copyright (c) 2004-2005 The OSSP Project @ 1.4 log @bump before release @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.3.2' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.3 log @Cleaned up and speed optimized perl/uuid_compat.pm (the Data::UUID compatibility module for Perl) Submitted by: David Wheeler @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.3.1' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @ 1.2 log @bump version before release @ text @d38 1 a38 1 use MIME::Base64; d55 3 a57 3 my $uuid = new OSSP::uuid; $uuid->make("v4"); return $uuid->export("bin"); d62 6 a67 6 my $uuid = new OSSP::uuid; my $nsiduuid = new OSSP::uuid; $nsiduuid->import("bin", $nsiduuid); $uuid = new OSSP::uuid; $uuid->make("v3", $nsiduuid, $name); return $uuid->export("bin"); d72 3 a74 3 my $uuid = new OSSP::uuid; $uuid->import("bin", $bin); return $uuid->export("str"); d79 4 a82 6 my $uuid = new OSSP::uuid; $uuid->import("bin", $bin); $_ = $uuid->export("str"); s/-//g; s/^/0x/; return $_; d92 7 a98 6 my $uuid = new OSSP::uuid; if ($str =~ /^0x(........)(....)(....)(....)(............)$/) { $str = "$1-$2-$3-$4-$5"; } $uuid->import("str", $str); return $uuid->export("bin"); d103 3 a105 6 my $uuid = new OSSP::uuid; if ($str =~ /^0x(........)(....)(....)(....)(............)$/) { $str = "$1-$2-$3-$4-$5"; } $uuid->import("str", $str); return $uuid->export("bin"); d115 4 a118 4 my $uuid1 = new OSSP::uuid; my $uuid2 = new OSSP::uuid; $uuid1->import("bin", $bin1); $uuid2->import("bin", $bin2); d122 16 d140 3 a142 29 my $ns; if ($arg eq "NameSpace_DNS") { $ns = "ns:DNS"; } elsif ($arg eq "NameSpace_URL") { $ns = "ns:URL"; } elsif ($arg eq "NameSpace_X500") { $ns = "ns:X500"; } elsif ($arg eq "NameSpace_OID") { $ns = "ns:OID"; } else { $ns = "nil"; } my $uuid = new OSSP::uuid; $uuid->load($ns); return $uuid->export("bin"); } sub NameSpace_DNS { my $self = new Data::UUID; return $self->constant("NameSpace_DNS"); } sub NameSpace_URL { my $self = new Data::UUID; return $self->constant("NameSpace_URL"); } sub NameSpace_X500 { my $self = new Data::UUID; return $self->constant("NameSpace_X500"); } sub NameSpace_OID { my $self = new Data::UUID; return $self->constant("NameSpace_OID"); d146 2 a147 3 my ($self) = @@_; my $uuid = $self->create(); return $self->to_string($uuid); d151 2 a152 3 my ($self) = @@_; my $uuid = $self->create(); return $self->to_hexstring($uuid); d156 2 a157 3 my ($self) = @@_; my $uuid = $self->create(); return $self->to_b64string($uuid); d161 2 a162 3 my ($self, $nsid, $name) = @@_; my $uuid = $self->create_from_name($nsid, $name); return $self->to_string($uuid); d166 2 a167 3 my ($self, $nsid, $name) = @@_; my $uuid = $self->create_from_name($nsid, $name); return $self->to_hexstring($uuid); d171 2 a172 3 my ($self, $nsid, $name) = @@_; my $uuid = $self->create_from_name($nsid, $name); return $self->to_b64string($uuid); @ 1.1 log @Added optional Data::UUID backward compatibility Perl API which can be enabled with the build-time option --with-perl-compat. Submitted by: Piotr Roszatycki @ text @d45 1 a45 1 our $VERSION = do { my @@v = ('1.3.0' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @@v); }; @