[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 9e16e5e3937c6eb97eeb59c96fcef683269b3dfc
Stefan Hornburg
racke at rt.icdevgroup.org
Mon Mar 22 12:24:57 UTC 2010
via 9e16e5e3937c6eb97eeb59c96fcef683269b3dfc (commit)
from 87a0533ff47cde677b3c33bfa720668d5474700e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9e16e5e3937c6eb97eeb59c96fcef683269b3dfc
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Mon Mar 22 13:24:13 2010 +0100
provide interface to Data::UUID for Interchange
-----------------------------------------------------------------------
Summary of changes and diff:
lib/Vend/UUID.pm | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 0 deletions(-)
create mode 100644 lib/Vend/UUID.pm
diff --git a/lib/Vend/UUID.pm b/lib/Vend/UUID.pm
new file mode 100644
index 0000000..3a7b095
--- /dev/null
+++ b/lib/Vend/UUID.pm
@@ -0,0 +1,74 @@
+# Vend::UUID - Interchange UUID helper functions
+#
+# Copyright (C) 2010 Stefan Hornburg (Racke) <racke at linuxia.de>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+
+package Vend::UUID;
+
+use strict;
+use warnings;
+
+use Data::UUID;
+
+use Vend::Config;
+
+Vend::Config::parse_tag('UserTag', 'uuid Order format namespace name');
+Vend::Config::parse_tag('UserTag', 'uuid MapRoutine Vend::UUID::uuid');
+
+sub uuid {
+ my ($format, $namespace, $name) = @_;
+ my ($uuid, $ret);
+
+ $uuid = new Data::UUID;
+
+ if ($format eq 'binary') {
+ if ($namespace =~ /\S/) {
+ $ret = $uuid->create_from_name_bin($namespace, $name);
+ }
+ else {
+ $ret = $uuid->create_bin();
+ }
+ }
+ elsif ($format eq 'hex') {
+ if ($namespace =~ /\S/) {
+ $ret = $uuid->create_from_name_hex($namespace, $name);
+ }
+ else {
+ $ret = $uuid->create_hex();
+ }
+ }
+ elsif ($format eq 'base64') {
+ if ($namespace =~ /\S/) {
+ $ret = $uuid->create_from_name_b64($namespace, $name);
+ }
+ else {
+ $ret = $uuid->create_b64();
+ }
+ }
+ else {
+ # conventional UUID string format used as default format
+ if ($namespace =~ /\S/) {
+ $ret = $uuid->create_from_name_str($namespace, $name);
+ }
+ else {
+ $ret = $uuid->create_str();
+ }
+ }
+
+ return $ret;
+}
+
+return 1;
hooks/post-receive
--
Interchange wellwell catalog
More information about the wellwell-devel
mailing list