OSSP CVS Repository

ossp - Check-in [5132]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5132
Date: 2005-Aug-31 11:59:45 (local)
2005-Aug-31 09:59:45 (UTC)
User:rse
Branch:
Comment: Added optional Data::UUID backward compatibility Perl API which can be enabled with the build-time option --with-perl-compat.

Submitted by: Piotr Roszatycki <dexter@debian.org>

Tickets:
Inspections:
Files:
ossp-pkg/uuid/ChangeLog      1.79 -> 1.80     5 inserted, 1 deleted
ossp-pkg/uuid/Makefile.in      1.27 -> 1.28     4 inserted, 3 deleted
ossp-pkg/uuid/README      1.28 -> 1.29     1 inserted, 1 deleted
ossp-pkg/uuid/devtool.conf      1.15 -> 1.16     3 inserted, 0 deleted
ossp-pkg/uuid/perl/MANIFEST      1.2 -> 1.3     3 inserted, 0 deleted
ossp-pkg/uuid/perl/Makefile.PL      1.5 -> 1.6     9 inserted, 3 deleted
ossp-pkg/uuid/perl/uuid.pm      added-> 1.11
ossp-pkg/uuid/perl/uuid_compat.pm      added-> 1.1
ossp-pkg/uuid/perl/uuid_compat.pod      added-> 1.1
ossp-pkg/uuid/perl/uuid_compat.ts      added-> 1.1
ossp-pkg/uuid/uuid.ac      1.14 -> 1.15     12 inserted, 1 deleted
ossp-pkg/uuid/uuid_vers.h      1.15 -> 1.16     9 inserted, 9 deleted

ossp-pkg/uuid/ChangeLog 1.79 -> 1.80

--- ChangeLog    2005/08/31 08:55:18     1.79
+++ ChangeLog    2005/08/31 09:59:45     1.80
@@ -11,7 +11,11 @@
   This is a list of all changes to OSSP uuid.
   For a more brief summary please have a look at the NEWS file.
 
-  Changes between 1.2.1 and 1.3.0 (30-Aug-2005 to xx-Sep-2005)
+  Changes between 1.2.1 and 1.3.0 (30-Aug-2005 to xx-XXX-2005)
+
+   o Added optional Data::UUID backward compatibility Perl API which can
+     be enabled with the build-time option --with-perl-compat.
+     [Piotr Roszatycki <dexter@debian.org>, Ralf S. Engelschall]
 
    o Add a functionality-reduced TIE-style Perl API OSSP::uuid::tie,
      intended for very high-level convenience programming.


ossp-pkg/uuid/Makefile.in 1.27 -> 1.28

--- Makefile.in  2005/03/06 11:29:25     1.27
+++ Makefile.in  2005/08/31 09:59:45     1.28
@@ -71,8 +71,9 @@
 
 TARGETS     = $(LIB_NAME) @DCE_NAME@ $(PRG_NAME) @PERL_NAME@
 
-WITH_DCE    = @WITH_DCE@
-WITH_PERL   = @WITH_PERL@
+WITH_DCE         = @WITH_DCE@
+WITH_PERL        = @WITH_PERL@
+WITH_PERL_COMPAT = @WITH_PERL_COMPAT@
 
 .SUFFIXES:
 .SUFFIXES: .c .o .lo
@@ -97,7 +98,7 @@
         @$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(PRG_NAME) $(PRG_OBJS) $(LIB_NAME) $(LIBS)
 
 $(PERL_NAME): $(PERL_OBJS) $(LIB_NAME)
-        @cd perl && $(PERL) Makefile.PL PREFIX=$(prefix) && $(MAKE) $(MFLAGS) all
+        @cd perl && $(PERL) Makefile.PL PREFIX=$(prefix) COMPAT=$(WITH_PERL_COMPAT) && $(MAKE) $(MFLAGS) all
         @touch $(PERL_NAME)
 
 uuid.lo: uuid.c config.h uuid.h uuid_md5.h uuid_sha1.h uuid_prng.h uuid_mac.h uuid_ui64.h uuid_str.h uuid_bm.h uuid_ac.h


ossp-pkg/uuid/README 1.28 -> 1.29

--- README       2005/08/30 20:38:10     1.28
+++ README       2005/08/31 09:59:45     1.29
@@ -5,7 +5,7 @@
   |_|_|_|  \___/|____/____/|_|      \__,_|\__,_|_|\__,_|
 
   OSSP uuid - Universally Unique Identifier
-  Version 1.2.1 (30-Aug-2005)
+  Version 1.3.0 (31-Aug-2005)
 
   ABSTRACT
 


ossp-pkg/uuid/devtool.conf 1.15 -> 1.16

--- devtool.conf 2005/08/31 07:26:29     1.15
+++ devtool.conf 2005/08/31 09:59:45     1.16
@@ -18,6 +18,7 @@
         --disable-shared \
         --enable-debug \
         --with-perl \
+        --with-perl-compat \
         "$@"
 
 %version
@@ -28,6 +29,8 @@
     V=`./shtool version -l c -d short uuid_vers.h`
     sed -e "s/\(v = ('\)[^']*\('\)/\1$V\2/g" <perl/uuid.pm >perl/uuid.pm.n
     mv perl/uuid.pm.n perl/uuid.pm
+    sed -e "s/\(v = ('\)[^']*\('\)/\1$V\2/g" <perl/uuid_compat.pm >perl/uuid_compat.pm.n
+    mv perl/uuid_compat.pm.n perl/uuid_compat.pm
 
 %dist
     echo "+++ removing old tarballs"


ossp-pkg/uuid/perl/MANIFEST 1.2 -> 1.3

--- MANIFEST     2004/11/03 18:01:50     1.2
+++ MANIFEST     2005/08/31 09:59:45     1.3
@@ -5,3 +5,6 @@
 uuid.pm
 uuid.pod
 uuid.ts
+uuid_compat.pm
+uuid_compat.pod
+uuid_compat.ts


ossp-pkg/uuid/perl/Makefile.PL 1.5 -> 1.6

--- Makefile.PL  2004/12/31 19:20:39     1.5
+++ Makefile.PL  2005/08/31 09:59:45     1.6
@@ -31,6 +31,9 @@
 use Config;
 use ExtUtils::MakeMaker;
 
+my $compat = 0;
+@ARGV = grep { $_ =~ m/^COMPAT=(\d+)$/i ? ($compat = $1, 0) : 1 } @ARGV;
+
 WriteMakefile(
     NAME              => 'OSSP::uuid',
     VERSION_FROM      => 'uuid.pm',
@@ -39,10 +42,13 @@
     LIBS              => [ '-L../.libs -luuid' ],
     DEFINE            => '',
     INC               => '-I. -I..',
-    PM                => { 'uuid.pm'  => '$(INST_LIBDIR)/uuid.pm',
-                           'uuid.pod' => '$(INST_LIBDIR)/uuid.pod' },
+    PM                => { 'uuid.pm'   => '$(INST_LIBDIR)/uuid.pm',
+                           'uuid.pod'  => '$(INST_LIBDIR)/uuid.pod',
+                           ($compat ? ('uuid_compat.pm'  => '$(INST_LIBDIR)/../Data/UUID.pm')  : ()),
+                           ($compat ? ('uuid_compat.pod' => '$(INST_LIBDIR)/../Data/UUID.pod') : ()),
+                         },
     TYPEMAPS          => [ 'uuid.tm' ],
-    test              => { TESTS => 'uuid.ts' },
+    test              => { TESTS => 'uuid.ts' . ($compat ? ' uuid_compat.ts' : '') },
     NO_META           => 1,
     #    cruel hack to workaround the conflict between OSSP uuid's
     #    uuid_create() function and one from FreeBSD's libc


ossp-pkg/uuid/perl/uuid.pm -> 1.11

*** /dev/null    Tue Apr 30 14:22:15 2024
--- -    Tue Apr 30 14:26:08 2024
***************
*** 0 ****
--- 1,330 ----
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##
+ ##  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.pm: Perl Binding (Perl part)
+ ##
+ 
+ ##
+ ##  High-Level Perl Module TIE-style API
+ ##  (just a functionality-reduced TIE wrapper around the OO-style API)
+ ##
+ 
+ package OSSP::uuid::tie;
+ 
+ use 5.008;
+ use strict;
+ use warnings;
+ use Carp;
+ 
+ #   inhert from Tie::Scalar
+ require Tie::Scalar;
+ our @ISA = qw(Tie::Scalar);
+ 
+ #   helper function
+ sub mode_sanity {
+     my ($mode) = @_;
+     if (not (    defined($mode)
+              and ref($mode) eq 'ARRAY'
+              and (   (@{$mode} == 1 and $mode->[0] =~ m|^v[14]$|)
+                   or (@{$mode} == 3 and $mode->[0] =~ m|^v[35]$|)))) {
+         return (undef, "invalid UUID generation mode specification");
+     }
+     if ($mode->[0] =~ m|^v[35]$|) {
+         my $uuid_ns = new OSSP::uuid;
+         $uuid_ns->load($mode->[1])
+             or return (undef, "failed to load UUID $mode->[0] namespace");
+         $mode->[1] = $uuid_ns;
+     }
+     return ($mode, undef);
+ }
+ 
+ #   constructor
+ sub TIESCALAR {
+     my ($class, @args) = @_;
+     my $self = {};
+     bless ($self, $class);
+     $self->{-uuid} = new OSSP::uuid
+        or croak "failed to create OSSP::uuid object";
+     my ($mode, $error) = mode_sanity(defined($args[0]) ? [ @args ] : [ "v1" ]);
+     croak $error if defined($error);
+     $self->{-mode} = $mode;
+     return $self;
+ }
+ 
+ #   destructor
+ sub DESTROY {
+     my ($self) = @_;
+     delete $self->{-uuid};
+     delete $self->{-mode};
+     return;
+ }
+ 
+ #   fetch value from scalar
+ #   (applied semantic: export UUID in string format)
+ sub FETCH {
+     my ($self) = @_;
+     $self->{-uuid}->make(@{$self->{-mode}})
+        or croak "failed to generate new UUID";
+     my $value = $self->{-uuid}->export("str")
+        or croak "failed to export new UUID";
+     return $value;
+ }
+ 
+ #   store value into scalar
+ #   (applied semantic: configure new UUID generation mode)
+ sub STORE {
+     my ($self, $value) = @_;
+     my ($mode, $error) = mode_sanity($value);
+     croak $error if defined($error);
+     $self->{-mode} = $mode;
+     return;
+ }
+ 
+ ##
+ ##  High-Level Perl Module OO-style API
+ ##  (just an OO wrapper around the C-style API)
+ ##
+ 
+ package OSSP::uuid;
+ 
+ use 5.008;
+ use strict;
+ use warnings;
+ use Carp;
+ use XSLoader;
+ use Exporter;
+ 
+ #   API version
+ our $VERSION = do { my @v = ('1.3.0' =~ m/\d+/g); sprintf("%d.".("%02d"x$#v), @v); };
+ 
+ #   API inheritance
+ our @ISA = qw(Exporter);
+ 
+ #   API symbols
+ my $symbols = {
+     'const' => [qw(
+         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_FMT_BIN
+         UUID_FMT_STR
+         UUID_FMT_TXT
+     )],
+     'func' => [qw(
+         uuid_create
+         uuid_destroy
+         uuid_load
+         uuid_make
+         uuid_isnil
+         uuid_compare
+         uuid_import
+         uuid_export
+         uuid_error
+         uuid_version
+     )]
+ };
+ 
+ #   API symbol exportation
+ our %EXPORT_TAGS = (
+     'all'   => [ @{$symbols->{'const'}}, @{$symbols->{'func'}} ],
+     'const' => [ @{$symbols->{'const'}} ],
+     'func'  => [ @{$symbols->{'func'}}  ]
+ );
+ our @EXPORT_OK = @{$EXPORT_TAGS{'all'}};
+ our @EXPORT    = ();
+ 
+ #   constructor
+ sub new {
+     my $proto = shift;
+     my $class = ref($proto) || $proto;
+     my $self = {};
+     bless ($self, $class);
+     $self->{-uuid} = undef;
+     $self->{-rc}   = $self->UUID_RC_OK;
+     my $rc = uuid_create($self->{-uuid});
+     if ($rc != $self->UUID_RC_OK) {
+         croak(sprintf("OSSP::uuid::new: uuid_create: %s (%d)", uuid_error($rc), $rc));
+         return undef;
+     }
+     return $self;
+ }
+ 
+ #   destructor
+ sub DESTROY ($) {
+     my ($self) = @_;
+     $self->{-rc} = uuid_destroy($self->{-uuid}) if (defined($self->{-uuid}));
+     if ($self->{-rc} != $self->UUID_RC_OK) {
+         carp(sprintf("OSSP::uuid::DESTROY: uuid_destroy: %s (%d)", uuid_error($self->{-rc}), $self->{-rc}));
+         return;
+     }
+     $self->{-uuid} = undef;
+     $self->{-rc}   = undef;
+     return;
+ }
+ 
+ sub load ($$) {
+     my ($self, $name) = @_;
+     $self->{-rc} = uuid_load($self->{-uuid}, $name);
+     return ($self->{-rc} == $self->UUID_RC_OK);
+ }
+ 
+ sub make ($$;@) {
+     my ($self, $mode, @valist) = @_;
+     my $mode_code = 0;
+     foreach my $spec (split(/,/, $mode)) {
+         if    ($spec eq 'v1') { $mode_code |= $self->UUID_MAKE_V1; }
+         elsif ($spec eq 'v3') { $mode_code |= $self->UUID_MAKE_V3; }
+         elsif ($spec eq 'v4') { $mode_code |= $self->UUID_MAKE_V4; }
+         elsif ($spec eq 'v5') { $mode_code |= $self->UUID_MAKE_V5; }
+         elsif ($spec eq 'mc') { $mode_code |= $self->UUID_MAKE_MC; }
+         else  { croak("invalid mode specification \"$spec\""); }
+     }
+     if (($mode_code & $self->UUID_MAKE_V3) or ($mode_code & $self->UUID_MAKE_V5)) {
+         if (not (ref($valist[0]) and $valist[0]->isa("OSSP::uuid"))) {
+             croak("UUID_MAKE_V3/UUID_MAKE_V5 requires namespace argument to be OSSP::uuid object");
+         }
+         my $ns   = $valist[0]->{-uuid};
+         my $name = $valist[1];
+         $self->{-rc} = uuid_make($self->{-uuid}, $mode_code, $ns, $name);
+     }
+     else {
+         $self->{-rc} = uuid_make($self->{-uuid}, $mode_code);
+     }
+     return ($self->{-rc} == $self->UUID_RC_OK);
+ }
+ 
+ sub isnil ($) {
+     my ($self) = @_;
+     my $result;
+     $self->{-rc} = uuid_isnil($self->{-uuid}, $result);
+     return ($self->{-rc} == $self->UUID_RC_OK ? $result : undef);
+ }
+ 
+ sub compare ($$) {
+     my ($self, $other) = @_;
+     my $result = 0;
+     if (not (ref($other) and $other->isa("OSSP::uuid"))) {
+         croak("argument has to an OSSP::uuid object");
+     }
+     $self->{-rc} = uuid_compare($self->{-uuid}, $other->{-uuid}, $result);
+     return ($self->{-rc} == $self->UUID_RC_OK ? $result : undef);
+ }
+ 
+ sub import {
+     #   ATTENTION: The OSSP uuid API function "import" conflicts with
+     #   the standardized "import" method the Perl world expects from
+     #   their modules. In order to keep the Perl binding consist
+     #   with the C API, we solve the conflict under run-time by
+     #   distinguishing between the two types of "import" calls.
+     if (defined($_[0]) and ref($_[0]) =~ m/^OSSP::uuid/) {
+         #   the regular OSSP::uuid "import" method
+         croak("import method expects 3 or 4 arguments") if (@_ < 3 or @_ > 4); # emulate prototype
+         my ($self, $fmt, $data_ptr, $data_len) = @_;
+         if    ($fmt eq 'bin') { $fmt = $self->UUID_FMT_BIN; }
+         elsif ($fmt eq 'str') { $fmt = $self->UUID_FMT_STR; }
+         elsif ($fmt eq 'txt') { $fmt = $self->UUID_FMT_TXT; }
+         else  { croak("invalid format \"$fmt\""); }
+         $data_len ||= length($data_ptr); # functional redudant, but Perl dislikes undef value here
+         $self->{-rc} = uuid_import($self->{-uuid}, $fmt, $data_ptr, $data_len);
+         return ($self->{-rc} == $self->UUID_RC_OK);
+     }
+     else {
+         #   the special Perl "import" method
+         #   (usually inherited from the Exporter)
+         no strict "refs";
+         return OSSP::uuid->export_to_level(1, @_);
+     }
+ }
+ 
+ sub export {
+     #   ATTENTION: The OSSP uuid API function "export" conflicts with
+     #   the standardized "export" method the Perl world expects from
+     #   their modules. In order to keep the Perl binding consist
+     #   with the C API, we solve the conflict under run-time by
+     #   distinguishing between the two types of "export" calls.
+     if (defined($_[0]) and ref($_[0]) =~ m/^OSSP::uuid/) {
+         #   the regular OSSP::uuid "export" method
+         croak("export method expects 2 arguments") if (@_ != 2); # emulate prototype
+         my ($self, $fmt) = @_;
+         my $data_ptr;
+         if    ($fmt eq 'bin') { $fmt = $self->UUID_FMT_BIN; }
+         elsif ($fmt eq 'str') { $fmt = $self->UUID_FMT_STR; }
+         elsif ($fmt eq 'txt') { $fmt = $self->UUID_FMT_TXT; }
+         else  { croak("invalid format \"$fmt\""); }
+         $self->{-rc} = uuid_export($self->{-uuid}, $fmt, $data_ptr, undef);
+         return ($self->{-rc} == $self->UUID_RC_OK ? $data_ptr : undef);
+     }
+     else {
+         #   the special Perl "export" method
+         #   (usually inherited from the Exporter)
+         return Exporter::export(@_);
+     }
+ }
+ 
+ sub error ($;$) {
+     my ($self, $rc) = @_;
+     $rc = $self->{-rc} if (not defined($rc));
+     return wantarray ? (uuid_error($rc), $rc) : uuid_error($rc);
+ }
+ 
+ sub version (;$) {
+     my ($self) = @_;
+     return uuid_version();
+ }
+ 
+ ##
+ ##  Low-Level Perl XS C-style API
+ ##  (actually just the activation of the XS part)
+ ##
+ 
+ #   auto-loading constants
+ sub AUTOLOAD {
+     my $constname;
+     our $AUTOLOAD;
+     ($constname = $AUTOLOAD) =~ s/.*:://;
+     croak "&OSSP::uuid::constant not defined" if ($constname eq 'constant');
+     my ($error, $val) = constant($constname);
+     croak $error if ($error);
+     { no strict 'refs'; *$AUTOLOAD = sub { $val }; }
+     goto &$AUTOLOAD;
+ }
+ 
+ #   static-loading functions
+ XSLoader::load('OSSP::uuid', $VERSION);
+ 
+ 1;
+ 


ossp-pkg/uuid/perl/uuid_compat.pm -> 1.1

*** /dev/null    Tue Apr 30 14:22:15 2024
--- -    Tue Apr 30 14:26:08 2024
***************
*** 0 ****
--- 1,196 ----
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##  Copyright (c) 2004 Piotr Roszatycki <dexter@debian.org>
+ ##
+ ##  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;
+ 
+ require Exporter;
+ 
+ our @ISA     = qw(Exporter);
+ our @EXPORT  = qw(NameSpace_DNS NameSpace_OID NameSpace_URL NameSpace_X500);
+ 
+ our $VERSION = do { my @v = ('1.3.0' =~ 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 = new OSSP::uuid;
+     $uuid->make("v4");
+     return $uuid->export("bin");
+ }
+ 
+ sub create_from_name {
+     my ($self, $nsid, $name) = @_;
+     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");
+ }
+ 
+ sub to_string {
+     my ($self, $bin) = @_;
+     my $uuid = new OSSP::uuid;
+     $uuid->import("bin", $bin);
+     return $uuid->export("str");
+ }
+ 
+ sub to_hexstring {
+     my ($self, $bin) = @_;
+     my $uuid = new OSSP::uuid;
+     $uuid->import("bin", $bin);
+     $_ = $uuid->export("str");
+     s/-//g;
+     s/^/0x/;
+     return $_;
+ }
+ 
+ sub to_b64string {
+     my ($self, $bin) = @_;
+     return MIME::Base64::encode_base64($bin);
+ }
+ 
+ sub from_string {
+     my ($self, $str) = @_;
+     my $uuid = new OSSP::uuid;
+     if ($str =~ /^0x(........)(....)(....)(....)(............)$/) {
+         $str = "$1-$2-$3-$4-$5";
+     }
+     $uuid->import("str", $str);
+     return $uuid->export("bin");
+ }
+ 
+ sub from_hexstring {
+     my ($self, $str) = @_;
+     my $uuid = new OSSP::uuid;
+     if ($str =~ /^0x(........)(....)(....)(....)(............)$/) {
+         $str = "$1-$2-$3-$4-$5";
+     }
+     $uuid->import("str", $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 = new OSSP::uuid;
+     my $uuid2 = new OSSP::uuid;
+     $uuid1->import("bin", $bin1);
+     $uuid2->import("bin", $bin2);
+     return $uuid1->compare($uuid2);
+ }
+ 
+ sub constant {
+     my ($self, $arg) = @_;
+     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");
+ }
+ 
+ sub create_str {
+     my ($self) = @_;
+     my $uuid = $self->create();
+     return $self->to_string($uuid);
+ }
+ 
+ sub create_hex {
+     my ($self) = @_;
+     my $uuid = $self->create();
+     return $self->to_hexstring($uuid);
+ }
+ 
+ sub create_b64 {
+     my ($self) = @_;
+     my $uuid = $self->create();
+     return $self->to_b64string($uuid);
+ }
+ 
+ sub create_from_name_str {
+     my ($self, $nsid, $name) = @_;
+     my $uuid = $self->create_from_name($nsid, $name);
+     return $self->to_string($uuid);
+ }
+ 
+ sub create_from_name_hex {
+     my ($self, $nsid, $name) = @_;
+     my $uuid = $self->create_from_name($nsid, $name);
+     return $self->to_hexstring($uuid);
+ }
+ 
+ sub create_from_name_b64 {
+     my ($self, $nsid, $name) = @_;
+     my $uuid = $self->create_from_name($nsid, $name);
+     return $self->to_b64string($uuid);
+ }
+ 
+ 1;
+ 


ossp-pkg/uuid/perl/uuid_compat.pod -> 1.1

*** /dev/null    Tue Apr 30 14:22:15 2024
--- -    Tue Apr 30 14:26:08 2024
***************
*** 0 ****
--- 1,53 ----
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##
+ ##  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.pod: Data::UUID Backward Compatibility Perl API (Perl/POD part)
+ ##
+ 
+ =pod
+ 
+ =head1 NAME
+ 
+ Data::UUID - B<OSSP uuid> Backward Compatibility Perl Binding
+ 
+ =head1 DESCRIPTION
+ 
+ B<Data::UUID> is the B<OSSP uuid> backward compatibility Perl binding
+ to the API of the original B<Data::UUID> module. It allows other
+ B<Data::UUID> based Perl modules to run with B<OSSP::uuid> without
+ changes.
+ 
+ =head1 SEE ALSO
+ 
+ B<OSSP::uuid>.
+ 
+ =head1 HISTORY
+ 
+ The backward compatibility Perl binding B<Data::UUID> for B<OSSP uuid>
+ was implemented in 2004 by Piotr Roszatycki E<lt>dexter@debian.orgE<gt>.
+ 
+ =cut
+ 


ossp-pkg/uuid/perl/uuid_compat.ts -> 1.1

*** /dev/null    Tue Apr 30 14:22:15 2024
--- -    Tue Apr 30 14:26:08 2024
***************
*** 0 ****
--- 1,55 ----
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##  Copyright (c) 2004 Piotr Roszatycki <dexter@debian.org>
+ ##
+ ##  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.ts: Data::UUID Backward Compatibility Perl API (Perl test suite part)
+ ##
+ 
+ use Test::More tests => 14;
+ 
+ BEGIN {
+     use_ok('Data::UUID');
+     use Data::UUID;
+ };
+ 
+ ok($ug = new Data::UUID);
+ 
+ ok($uuid1 = $ug->create());
+ ok($uuid2 = $ug->to_hexstring($uuid1));
+ ok($uuid3 = $ug->from_string($uuid2));
+ ok($ug->compare($uuid1, $uuid3) == 0);
+ 
+ ok($uuid4 = $ug->to_b64string($uuid1));
+ ok($uuid5 = $ug->to_b64string($uuid3));
+ ok($uuid4 eq $uuid5);
+ 
+ ok($uuid6 = $ug->from_b64string($uuid5));
+ ok($ug->compare($uuid6, $uuid1) == 0);
+ 
+ ok($uuid7 = NameSpace_URL);
+ ok($uuid8 = $ug->from_string("6ba7b811-9dad-11d1-80b4-00c04fd430c8"));
+ ok($ug->compare($uuid7, $uuid8) == 0);
+ 


ossp-pkg/uuid/uuid.ac 1.14 -> 1.15

--- uuid.ac      2004/12/31 19:20:34     1.14
+++ uuid.ac      2005/08/31 09:59:45     1.15
@@ -91,6 +91,10 @@
         AS_HELP_STRING([--with-perl], [build Perl bindings to C API]),
         [ac_cv_with_perl=$withval], [ac_cv_with_perl=no])
     AC_CACHE_CHECK([whether to build Perl bindings to C API], [ac_cv_with_perl], [ac_cv_with_perl=no])
+    AC_ARG_WITH([perl-compat],
+        AS_HELP_STRING([--with-perl-compat], [build Perl compatibility API]),
+        [ac_cv_with_perl_compat=$withval], [ac_cv_with_perl_compat=no])
+    AC_CACHE_CHECK([whether to build Perl compatibility API], [ac_cv_with_perl_compat], [ac_cv_with_perl_compat=no])
     if test ".$ac_cv_with_perl" = ".yes"; then
         AC_DEFINE(WITH_PERL, 1, [whether to build Perl bindings to C API])
         WITH_PERL='yes'
@@ -99,8 +103,15 @@
         WITH_PERL='no'
         PERL_NAME=''
     fi
-    AC_SUBST(WITH_PERL)
+    if test ".$ac_cv_with_perl_compat" = ".yes"; then
+        AC_DEFINE(WITH_PERL_COMPAT, 1, [whether to build Perl compatibility API])
+        WITH_PERL_COMPAT=1
+    else
+        WITH_PERL_COMPAT=0
+    fi
     AC_SUBST(PERL_NAME)
+    AC_SUBST(WITH_PERL)
+    AC_SUBST(WITH_PERL_COMPAT)
     AC_PATH_PROG(PERL, perl, NA)
     if test ".$ac_cv_with_perl" = ".yes" -a ".$PERL" = ".NA"; then
         AC_ERROR([required Perl interpreter not found in \$PATH])


ossp-pkg/uuid/uuid_vers.h 1.15 -> 1.16

--- uuid_vers.h  2005/08/30 20:11:46     1.15
+++ uuid_vers.h  2005/08/31 09:59:45     1.16
@@ -8,7 +8,7 @@
 #ifndef _UUID_VERS_H_
 #define _UUID_VERS_H_
 
-#define _UUID_VERSION 0x102201
+#define _UUID_VERSION 0x103200
 
 typedef struct {
     const int   v_hex;
@@ -32,14 +32,14 @@
 #undef  _UUID_VERS_H_AS_HEADER_
 
 _uuid_version_t _uuid_version = {
-    0x102201,
-    "1.2.1",
-    "1.2.1 (30-Aug-2005)",
-    "This is OSSP uuid, Version 1.2.1 (30-Aug-2005)",
-    "OSSP uuid 1.2.1 (30-Aug-2005)",
-    "OSSP uuid/1.2.1",
-    "@(#)OSSP uuid 1.2.1 (30-Aug-2005)",
-    "$Id: OSSP uuid 1.2.1 (30-Aug-2005) $"
+    0x103200,
+    "1.3.0",
+    "1.3.0 (31-Aug-2005)",
+    "This is OSSP uuid, Version 1.3.0 (31-Aug-2005)",
+    "OSSP uuid 1.3.0 (31-Aug-2005)",
+    "OSSP uuid/1.3.0",
+    "@(#)OSSP uuid 1.3.0 (31-Aug-2005)",
+    "$Id: OSSP uuid 1.3.0 (31-Aug-2005) $"
 };
 
 #endif /* _UUID_VERS_H_AS_HEADER_ */

CVSTrac 2.0.1