Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docu-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
docu-tools
Commits
28217836
Commit
28217836
authored
Apr 11, 2015
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
playing with UUID generation
parent
5e95f1a2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
perl/Gnome-Tomboy/lib/Tomboy.pm
+27
-21
27 additions, 21 deletions
perl/Gnome-Tomboy/lib/Tomboy.pm
perl/Gnome-Tomboy/tom
+2
-1
2 additions, 1 deletion
perl/Gnome-Tomboy/tom
perl/Gnome-Tomboy/x_uuid.pl
+29
-9
29 additions, 9 deletions
perl/Gnome-Tomboy/x_uuid.pl
with
58 additions
and
31 deletions
perl/Gnome-Tomboy/lib/Tomboy.pm
+
27
−
21
View file @
28217836
...
...
@@ -23,10 +23,35 @@ package Tomboy;
use
strict
;
# use UUID;
use
Data::
UUID
;
use
POSIX
;
eval
{
require
UUID
;
sub
get_uuid
{
my
(
$uuid
,
$uuid_str
);
UUID::
generate
(
$uuid
);
UUID::
unparse
(
$uuid
,
$uuid_str
);
$uuid_str
;
}
};
if
(
$@
)
{
eval
{
require
Data::
UUID
;
};
if
(
$@
)
{
die
"
install either UUID or Data::UUID
";
}
sub
get_uuid
{
my
$uc
=
new
Data::
UUID
;
my
$str
=
$uc
->
create_str
();
$str
=~
tr/A-F/a-f/
;
$str
;
}
}
my
%options_passed
=
map
{
$_
=>
1
}
qw(--note-path)
;
# used by start_tb() function
sub
link
...
...
@@ -56,25 +81,6 @@ sub ts_ISO
strftime
('
%FT%T.000000%z
',
@ts
);
}
sub
get_uuid
{
=begin comment
my ($uuid, $uuid_str);
UUID::generate ($uuid);
UUID::unparse ($uuid, $uuid_str);
$uuid_str;
=end comment
=cut
my
$uc
=
new
Data::
UUID
;
my
$str
=
$uc
->
create_str
();
$str
=~
tr/A-F/a-f/
;
$str
;
}
sub
start_tb
{
my
%par
=
@_
;
...
...
This diff is collapsed.
Click to expand it.
perl/Gnome-Tomboy/tom
+
2
−
1
View file @
28217836
...
...
@@ -51,6 +51,7 @@ use Tomboy::TOC;
my
$toc_file
;
my
$note_dir
=
$ENV
{'
HOME
'}
.
'
/.local/share/tomboy
';
# TODO: does not work on cygwin!
my
$note_dir_changed
=
0
;
my
$start_tb
=
0
;
...
...
@@ -71,7 +72,7 @@ while (my $arg= shift (@ARGV))
}
elsif
(
$arg
=~
/^--(.+)/
)
{
my
(
$op
,
$val
)
=
split
('
=
',
$
1
);
my
(
$op
,
$val
)
=
split
('
=
',
$
1
,
2
);
print
"
op=[
$op
] val=[
$val
]
\n
";
if
(
$op
eq
'
note-path
')
{
$note_dir
=
$val
||
shift
(
@ARGV
);
$note_dir_changed
=
1
;
}
...
...
This diff is collapsed.
Click to expand it.
perl/Gnome-Tomboy/x_uuid.pl
+
29
−
9
View file @
28217836
...
...
@@ -2,10 +2,32 @@
use
strict
;
use
UUID
;
use
Data::
UUID
;
use
POSIX
;
eval
{
require
UUID
;
sub
get_uuid_1
{
my
(
$uuid
,
$uuid_str
);
UUID::
generate
(
$uuid
);
UUID::
unparse
(
$uuid
,
$uuid_str
);
$uuid_str
;
}
};
if
(
$@
)
{
print
"
no UUID package
\n
";
require
Data::
UUID
;
sub
get_uuid_1
{
get_uuid_2
();
}
}
my
$max
=
shift
(
@ARGV
)
||
10
;
for
(
my
$i
=
0
;
$i
<
$max
;
$i
++
)
...
...
@@ -16,13 +38,7 @@ for (my $i= 0; $i< $max; $i++)
printf
("
%5d %s %s %s
\n
",
$i
,
$ts
,
$u1
,
$u2
);
}
sub
get_uuid_1
{
my
(
$uuid
,
$uuid_str
);
UUID::
generate
(
$uuid
);
UUID::
unparse
(
$uuid
,
$uuid_str
);
$uuid_str
;
}
=begin junk
sub get_uuid_2b
{
...
...
@@ -34,6 +50,9 @@ sub get_uuid_2b
$str;
}
=end junk
=cut
sub
get_uuid_2
{
my
$uc
=
new
Data::
UUID
;
...
...
@@ -48,3 +67,4 @@ sub ts_iso
# print "ts_iso=[$ts_iso]\n";
$ts_iso
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment