logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Types::UUID - type constraints for UUIDs

Author

       Toby Inkster <tobyink@cpan.org>.

Bugs

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

Description

       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.

perl v5.38.2                                       2024-03-08                                   Types::UUID(3pm)

Name

       Types::UUID - type constraints for UUIDs

See Also

       Type::Tiny::Manual, UUID::Tiny.

Synopsis

          package FroobleStick;

          use Moo;
          use Types::UUID;

          has identifier => (
             is      => 'lazy',
             isa     => Uuid,
             coerce  => 1,
             builder => Uuid->generator,
          );

See Also