r51976 - in /trunk/libuuid-tiny-perl: Changes META.yml README debian/changelog debian/control lib/UUID/Tiny.pm

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Mon Feb 1 00:34:45 UTC 2010


Author: jawnsy-guest
Date: Mon Feb  1 00:34:39 2010
New Revision: 51976

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51976
Log:
* New upstream release
* Upstream implementation uses Digest::SHA or falls back to
  Digest::SHA1 (the latter is part of core since 5.9.3, or 5.10 in
  Debian)
* Standards-Version 3.8.4 (no changes)

Modified:
    trunk/libuuid-tiny-perl/Changes
    trunk/libuuid-tiny-perl/META.yml
    trunk/libuuid-tiny-perl/README
    trunk/libuuid-tiny-perl/debian/changelog
    trunk/libuuid-tiny-perl/debian/control
    trunk/libuuid-tiny-perl/lib/UUID/Tiny.pm

Modified: trunk/libuuid-tiny-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libuuid-tiny-perl/Changes?rev=51976&op=diff
==============================================================================
--- trunk/libuuid-tiny-perl/Changes (original)
+++ trunk/libuuid-tiny-perl/Changes Mon Feb  1 00:34:39 2010
@@ -1,4 +1,10 @@
 Revision history for UUID-Tiny
+
+1.03    2010-01-31, caugustin.de
+        Once again clk_seq uniqueness and fixing some small bugs with
+        _get_clk_seq() (due to failed CPAN Tester's ID 6750882).
+        Changed COPYRIGHT due to rt.cpan.org Bug #53642.
+        License should now be shown in CPAN.
 
 1.0202  2010-01-12, caugustin.de
         Fixed a small bug (calling _init_globals without need).

Modified: trunk/libuuid-tiny-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libuuid-tiny-perl/META.yml?rev=51976&op=diff
==============================================================================
--- trunk/libuuid-tiny-perl/META.yml (original)
+++ trunk/libuuid-tiny-perl/META.yml Mon Feb  1 00:34:39 2010
@@ -1,18 +1,29 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         UUID-Tiny
-version:      1.0202
-version_from: lib/UUID/Tiny.pm
-installdirs:  site
+--- #YAML:1.0
+name:               UUID-Tiny
+version:            1.03
+abstract:           Pure Perl UUID Support With Functional Interface
+author:
+    - Christian Augustin <mail at caugustin.de>
+license:            perl
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    Carp:                          0
-    Digest::MD5:                   0
-    Digest::SHA1:                  0
-    IO::File:                      0
-    MIME::Base64:                  0
-    POSIX:                         0
-    Test::More:                    0
-    Time::HiRes:                   0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+    Carp:          0
+    Digest::MD5:   0
+    Digest::SHA1:  0
+    IO::File:      0
+    MIME::Base64:  0
+    POSIX:         0
+    Test::More:    0
+    Time::HiRes:   0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.56
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libuuid-tiny-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libuuid-tiny-perl/README?rev=51976&op=diff
==============================================================================
--- trunk/libuuid-tiny-perl/README (original)
+++ trunk/libuuid-tiny-perl/README Mon Feb  1 00:34:39 2010
@@ -1,4 +1,4 @@
-UUID-Tiny Version 1.0202
+UUID-Tiny Version 1.03
 
 This is a Pure Perl module for the creation of UUIDs:
 
@@ -33,7 +33,7 @@
 
     Carp
     Digest::MD5
-    Digest::SHA1
+    Digest::SHA1 (or Digest::SHA or Digest::SHA::PurePerl)
     MIME::Base64
     Time::HiRes
     POSIX

Modified: trunk/libuuid-tiny-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libuuid-tiny-perl/debian/changelog?rev=51976&op=diff
==============================================================================
--- trunk/libuuid-tiny-perl/debian/changelog (original)
+++ trunk/libuuid-tiny-perl/debian/changelog Mon Feb  1 00:34:39 2010
@@ -1,3 +1,13 @@
+libuuid-tiny-perl (1.0300-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Upstream implementation uses Digest::SHA or falls back to
+    Digest::SHA1 (the latter is part of core since 5.9.3, or 5.10 in
+    Debian)
+  * Standards-Version 3.8.4 (no changes)
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Sun, 31 Jan 2010 19:46:54 -0500
+
 libuuid-tiny-perl (1.0202-1) unstable; urgency=low
 
   [ Jonathan Yu ]

Modified: trunk/libuuid-tiny-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libuuid-tiny-perl/debian/control?rev=51976&op=diff
==============================================================================
--- trunk/libuuid-tiny-perl/debian/control (original)
+++ trunk/libuuid-tiny-perl/debian/control Mon Feb  1 00:34:39 2010
@@ -2,19 +2,20 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl, libdigest-sha1-perl,
- libtest-pod-perl, libtest-pod-coverage-perl
+Build-Depends-Indep: perl, libtest-pod-perl, libtest-pod-coverage-perl,
+ perl (>= 5.10) | libdigest-sha-perl | libdigest-sha1-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Christine Spang <christine at debian.org>,
  Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/UUID-Tiny/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libuuid-tiny-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libuuid-tiny-perl
 
 Package: libuuid-tiny-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libdigest-sha1-perl
+Depends: ${perl:Depends}, ${misc:Depends},
+ perl (>= 5.10) | libdigest-sha-perl | libdigest-sha1-perl
 Description: pure Perl module to generate v1, v3, v4, and v5 UUIDs
  UUID::Tiny provides a simple, non-object-oriented interface for generating
  UUIDs from Perl code. It is not suitable for performance-sensitive UUID

Modified: trunk/libuuid-tiny-perl/lib/UUID/Tiny.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libuuid-tiny-perl/lib/UUID/Tiny.pm?rev=51976&op=diff
==============================================================================
--- trunk/libuuid-tiny-perl/lib/UUID/Tiny.pm (original)
+++ trunk/libuuid-tiny-perl/lib/UUID/Tiny.pm Mon Feb  1 00:34:39 2010
@@ -37,11 +37,11 @@
 
 =head1 VERSION
 
-Version 1.0201
-
-=cut
-
-our $VERSION = '1.0202';
+Version 1.03
+
+=cut
+
+our $VERSION = '1.03';
 
 
 =head1 SYNOPSIS
@@ -295,7 +295,7 @@
     my $v3_md5_UUID  = create_UUID(UUID_V3, $ns_uuid, $name_or_filehandle);
     my $v3_md5_UUID  = create_UUID(UUID_V3, $name_or_filehandle);
     my $v4_rand_UUID = create_UUID(UUID_V4);
-    my $v5_sha1_UUID = create_UUID(UUID_V5, $ns_uuid $name_or_filehandle);
+    my $v5_sha1_UUID = create_UUID(UUID_V5, $ns_uuid, $name_or_filehandle);
     my $v5_sha1_UUID = create_UUID(UUID_V5, $name_or_filehandle);
 
 Creates a binary UUID in network byte order (MSB first). For v3 and v5 UUIDs a
@@ -380,7 +380,7 @@
     # Set random node in UUID ...
     substr $uuid, 10, 6, _random_node_id();
 
-    return _set_uuid_version($uuid => 0x10);
+    return _set_uuid_version($uuid, 0x10);
 }
 
 sub _create_v3_uuid {
@@ -415,7 +415,7 @@
     # Use only first 16 Bytes ...
     $uuid = substr( $MD5_CALCULATOR->digest(), 0, 16 ); 
 
-    return _set_uuid_version( $uuid => 0x30 );
+    return _set_uuid_version( $uuid, 0x30 );
 }
 
 sub _create_v4_uuid {
@@ -425,7 +425,7 @@
         $uuid .= pack 'I', _rand_32bit();
     }
 
-    return _set_uuid_version($uuid => 0x40);
+    return _set_uuid_version($uuid, 0x40);
 }
 
 sub _create_v5_uuid {
@@ -464,7 +464,7 @@
     # Use only first 16 Bytes ...
     $uuid = substr( $SHA1_CALCULATOR->digest(), 0, 16 );
 
-    return _set_uuid_version($uuid => 0x50);
+    return _set_uuid_version($uuid, 0x50);
 }
 
 sub _set_uuid_version {
@@ -522,9 +522,9 @@
         if $uuid =~ m/$IS_UUID_STRING/;
     croak __PACKAGE__ . "::uuid_to_string(): Invalid UUID!"
         unless length $uuid == 16;
-    return  join q{-},
+    return  join '-',
             map { unpack 'H*', $_ }
-            map { substr $uuid, 0, $_, q{} }
+            map { substr $uuid, 0, $_, '' }
             ( 4, 2, 2, 2, 6 );
 }
 
@@ -696,16 +696,14 @@
     if (!defined $Last_Pid || $Last_Pid != $$) {
         $Last_Pid = $$;
         # $Clk_Seq = _generate_clk_seq();
-        my $new_clk_seq = _generate_clk_seq();
-        if (!defined($Clk_Seq) || $new_clk_seq != $Clk_Seq) {
-            $Clk_Seq = $new_clk_seq;
-        }
-        else {
-            $new_clk_seq = _generate_clk_seq();
-            if ($new_clk_seq != $Clk_Seq) {
+        # There's a slight chance to get the same value as $Clk_Seq ...
+        for (my $i = 0; $i <= 5; $i++) {
+            my $new_clk_seq = _generate_clk_seq();
+            if (!defined($Clk_Seq) || $new_clk_seq != $Clk_Seq) {
                 $Clk_Seq = $new_clk_seq;
+                last;
             }
-            else {
+            if ($i == 5) {
                 croak __PACKAGE__
                     . "::_init_globals(): Can't get unique clk_seq!";
             }
@@ -716,7 +714,6 @@
     return;
 }
 
-
 my $Last_Timestamp;
 
 sub _get_clk_seq {
@@ -726,12 +723,18 @@
     lock $Last_Timestamp;
     lock $Clk_Seq;
 
-    if (!defined $Last_Timestamp || $ts <= $Last_Timestamp) {
-        $Clk_Seq = ($Clk_Seq + 1) % 65536;
+    #if (!defined $Last_Timestamp || $ts <= $Last_Timestamp) {
+    if (defined $Last_Timestamp && $ts <= $Last_Timestamp) {
+        #$Clk_Seq = ($Clk_Seq + 1) % 65536;
+        # The old variant used modulo, but this looks unnecessary,
+        # because we should only use the signigicant part of the
+        # number, and that also lets the counter circle around:
+        $Clk_Seq = ($Clk_Seq + 1) & 0x3fff;
     }
     $Last_Timestamp = $ts;
 
-    return $Clk_Seq & 0x03ff;
+    #return $Clk_Seq & 0x03ff; # no longer needed - and it was wrong too!
+    return $Clk_Seq;
 }
 
 sub _generate_clk_seq {
@@ -739,11 +742,12 @@
     # _init_globals();
 
     my @data;
-    push @data, q{}  . $$;
-    push @data, q{:} . Time::HiRes::time();
+    push @data, ''  . $$;
+    push @data, ':' . Time::HiRes::time();
 
     # 16 bit digest
-    return unpack 'n', _digest_as_octets(2, @data);
+    # We should return only the significant part of the number!
+    return (unpack 'n', _digest_as_octets(2, @data)) & 0x3fff;
 }
 
 sub _random_node_id {
@@ -777,9 +781,9 @@
     my $x = "\x0" x $num_octets;
 
     while (length $s > 0) {
-        my $n = q{};
+        my $n = '';
         while (length $x > 0) {
-            my $c = ord(substr $x, -1, 1, q{}) ^ ord(substr $s, -1, 1, q{});
+            my $c = ord(substr $x, -1, 1, '') ^ ord(substr $s, -1, 1, '');
             $n = chr($c) . $n;
             last if length $s <= 0;
         }
@@ -835,7 +839,12 @@
 
 =head1 AUTHOR
 
-Much of this code is borrowed from UUID::Generator by ITO Nobuaki
+Christian Augustin, C<< <mail at caugustin.de> >>
+
+
+=head1 CONTRIBUTORS
+
+Some of this code is based on UUID::Generator by ITO Nobuaki
 E<lt>banb at cpan.orgE<gt>. But that module is announced to be marked as
 "deprecated" in the future and it is much too complicated for my liking.
 
@@ -843,9 +852,8 @@
 parts with a functional interface ...
 
 Jesse Vincent, C<< <jesse at bestpractical.com> >>, improved version 1.02 with
-his tips and a heavy refactoring. Consider him a co-author of UUID::Tiny.
-
--- Christian Augustin, C<< <mail at caugustin.de> >>
+his tips and a heavy refactoring.
+
 
 
 =head1 BUGS
@@ -897,11 +905,14 @@
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009 Christian Augustin, all rights reserved.
+Copyright 2009, 2010 Christian Augustin, all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
 
+ITO Nobuaki has very graciously given me permission to take over copyright for
+the portions of code that are copied from or resemble his work (see
+rt.cpan.org #53642 L<https://rt.cpan.org/Public/Bug/Display.html?id=53642>).
 
 =cut
 




More information about the Pkg-perl-cvs-commits mailing list