Types::UUID(3pm)

Types::UUID3pm

Type constraints for uuids

Usage

   package FroobleStick;
   
   use Moo;
   use Types::UUID;
   
   has identifier => (
      is      => 'lazy',
      isa     => Uuid,
      coerce  => 1,
      builder => Uuid->generator,
   );

Overview

Types::UUID is a type constraint library suitable for use with Moo/Moose attributes, Kavorka sub signatures, and so forth.

Type

Currently the module only provides one type constraint, which is exported by default.

"Uuid"

A valid UUID string, as judged by the is_uuid_string() function provided by UUID::Tiny.

This constraint has coercions from "Undef" (generates a new UUID), "Str" (fixes slightly broken-looking UUIDs, adding missing dashes; also accepts base-64-encoded UUIDs) and URI objects using the "urn:uuid:" URI scheme.

Methods

The "Uuid" type constraint is actually blessed into a subclass of Type::Tiny, and provides an aditional method:

"Uuid->generate"

Generates a new UUID. "Uuid->coerce(undef)" would also work, but looks a little odd.

"Uuid->generator"

Returns a coderef which generates a new UUID. For an example usage, see the "SYNOPSIS".

Disclaimer of warranties

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Releases

6 releases since Debian 8 (Jessie); the text changed 4 times.

  1. 8
  2. 9–10
  3. 11
  4. 12
  5. 13

Bugs

Please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=Types-UUID>.

Author

Toby Inkster <[email protected]>.

From libtypes-uuid-perl 0.004-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.