Skip to content
Snippets Groups Projects
Commit b1c75529 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

playing around with UUID generation methods; cygwin does not have a plain UUID...

playing around with UUID generation methods; cygwin does not have a plain UUID module but Data::UUID generates very uniform UUIDs
parent 3413d07d
No related branches found
No related tags found
No related merge requests found
#!/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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment