From b1c75529aaf39c3e50114b1ddb87c017360114e1 Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Sat, 11 Apr 2015 04:47:57 +0200
Subject: [PATCH] playing around with UUID generation methods; cygwin does not
 have a plain UUID module but Data::UUID generates very uniform UUIDs

---
 perl/Gnome-Tomboy/x_uuid.pl | 40 +++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100755 perl/Gnome-Tomboy/x_uuid.pl

diff --git a/perl/Gnome-Tomboy/x_uuid.pl b/perl/Gnome-Tomboy/x_uuid.pl
new file mode 100755
index 0000000..af944f8
--- /dev/null
+++ b/perl/Gnome-Tomboy/x_uuid.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+use strict;
+
+use UUID;
+use Data::UUID;
+
+for (my $i= 0; $i< 10; $i++)
+{
+  my $u1= get_uuid_1();
+  my $u2= get_uuid_2();
+  printf ("%3d %s %s\n", $i, $u1, $u2);
+}
+
+sub get_uuid_1
+{
+  my ($uuid, $uuid_str);
+  UUID::generate ($uuid);
+  UUID::unparse ($uuid, $uuid_str);
+  $uuid_str;
+}
+
+sub get_uuid_2b
+{
+# generates the same string all the time.
+  my $uc= new Data::UUID;
+  my $ui= $uc->create_from_name(NameSpace_OID, "at.urxn");
+  my $str= $uc->to_string($ui);
+  $str =~ tr/A-F/a-f/;
+  $str;
+}
+
+sub get_uuid_2
+{
+  my $uc= new Data::UUID;
+  my $str= $uc->create_str();
+  $str =~ tr/A-F/a-f/;
+  $str;
+}
+
-- 
GitLab