Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Util::UUID
Source

Index


NAME ^

Newcomen::Util::UUID - UUID related utility functions.

SYNOPSIS ^

use Newcomen::Util::UUID;

# Generate a version 5 UUID:
my $uuid = Newcomen::Util::UUID::uuid_v5 ($namespace, $string);

DESCRIPTION ^

This package provides utility functions dealing with UUIDs. Note that all functions may be imported into the package using Newcomen::Util::UUID:

use Newcomen::Util::UUID qw( uuid_v5 );

No function is exported by default.

FUNCTIONS ^

uuid_v5

Toggle source:   uuid_v5

sub uuid_v5 {

   my $namespace = shift;
   my $string    = shift;

   return UUID::Tiny::create_uuid_as_string (UUID::Tiny::UUID_V5, $namespace, $string);

}
my $uuid = uuid_v5 ($namespace, $string);

Generates a version 5 (SHA-1-based) UUID, generated from the namespace (first parameter, this has to be a valid UUID string) and an arbitrary string (second parameter). Currently uses UUID::Tiny to do the work. Returns the string representation of the generated UUID.

Note: No error checking is performed, make sure the first parameter is valid!

SEE ALSO ^

UUID::Tiny

VERSION ^

This is version 2014052501.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 Stefan Goebel.

This file is part of Newcomen.

Newcomen 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 3 of the license, or (at your option) any later version.

Newcomen 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 Newcomen. If not, see <http://www.gnu.org/licenses/>.