KiokuDB::Role::UUIDs - UUID generation role.


KiokuDB documentation Contained in the KiokuDB distribution.

Index


Code Index:

NAME

Top

KiokuDB::Role::UUIDs - UUID generation role.

SYNOPSIS

Top

    with qw(KiokuDB::Role::UUIDs);

DESCRIPTION

Top

This role provides UUID assignment.

Depending on the $SERIAL_IDS variable being true at compile time, and availability of UUID generation module (Data::UUID::LibUUID falling back to Data::UUID) an implementation role is selected.

METHODS

Top

generate_uuid

Create a new UUID


KiokuDB documentation Contained in the KiokuDB distribution.

#!/usr/bin/perl

package KiokuDB::Role::UUIDs;
use Moose::Role;

use Try::Tiny;

use namespace::clean -except => 'meta';

if ( defined &KiokuDB::SERIAL_IDS and KiokuDB::SERIAL_IDS() ) {
    with qw(KiokuDB::Role::UUIDs::SerialIDs);
} else {
    my $have_libuuid = try { require Data::UUID::LibUUID; 1 };

    my $backend = $have_libuuid ? "LibUUID" : "DataUUID";

    with "KiokuDB::Role::UUIDs::$backend";
}

__PACKAGE__

__END__