1Types::UUID(3) User Contributed Perl Documentation Types::UUID(3)
2
3
4
6 Types::UUID - type constraints for UUIDs
7
9 package FroobleStick;
10
11 use Moo;
12 use Types::UUID;
13
14 has identifier => (
15 is => 'lazy',
16 isa => Uuid,
17 coerce => 1,
18 builder => Uuid->generator,
19 );
20
22 Types::UUID is a type constraint library suitable for use with
23 Moo/Moose attributes, Kavorka sub signatures, and so forth.
24
25 Type
26 Currently the module only provides one type constraint, which is
27 exported by default.
28
29 "Uuid"
30 A valid UUID string, as judged by the "is_uuid_string()" function
31 provided by UUID::Tiny.
32
33 This constraint has coercions from "Undef" (generates a new UUID),
34 "Str" (fixes slightly broken-looking UUIDs, adding missing dashes;
35 also accepts base-64-encoded UUIDs) and URI objects using the
36 "urn:uuid:" URI scheme.
37
38 Methods
39 The "Uuid" type constraint is actually blessed into a subclass of
40 Type::Tiny, and provides an aditional method:
41
42 "Uuid->generate"
43 Generates a new UUID. "Uuid->coerce(undef)" would also work, but
44 looks a little odd.
45
46 "Uuid->generator"
47 Returns a coderef which generates a new UUID. For an example usage,
48 see the "SYNOPSIS".
49
51 Please report any bugs to
52 <http://rt.cpan.org/Dist/Display.html?Queue=Types-UUID>.
53
55 Type::Tiny::Manual, UUID::Tiny.
56
58 Toby Inkster <tobyink@cpan.org>.
59
61 This software is copyright (c) 2014 by Toby Inkster.
62
63 This is free software; you can redistribute it and/or modify it under
64 the same terms as the Perl 5 programming language system itself.
65
67 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
68 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
69 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
70
71
72
73perl v5.30.1 2020-01-30 Types::UUID(3)