The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::Validate::UUID - Data Validator to check for well formed UUIDs

SYNOPSIS

use Data::Validate::UUID qw( is_uuid );

my $valid_uuid   = '91AE3596-95FA-11E4-AB6C-6CFF01D6B4DB';
my $invalid_uuid = 'INVALID UUID';

if( is_uuid( $valid_uuid ) ) {
    print 'Looks good to me!';
}

if( !is_uuid( $invalid_uuid ) ) {
    print 'Not a valid UUID!';
}

DESCRIPTION

Data::Validate::UUID optionally exports a single method is_uuid that will check the format of the provided UUID to see if it conforms to RFC 4122. For more information about UUID's and a perl module for generating them please see Data::UUID.

METHODS

is_uuid

is_uuid( '91AE3596-95FA-11E4-AB6C-6CFF01D6B4DB' );  # returns truthy
is_uuid( 'INVALID UUID' );                          # returns falsey

is_uuid accepts a scalar and returns a truthy or falsey value based on if the provided value is a valid UUID.

ACKNOWLEDGEMENTS

The Regular Expression used in this module comes from DrEinsteinium on the Bukkit forums. This is a link to the thread. I've also seen this Regular Expression posted by Gambol in this stack overflow answer. Hopefully they don't mind me packaging it up for distrubtion.

Special thanks to BrainStorm Incubator for providing development resources and allowing this module to be open soruced.

AUTHORS

Robert Stone, drzigman AT cpan DOT org

COPYRIGHT & LICENSE

Copyright 2014 Robert Stone

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU Lesser General Public License as published by the Free Software Foundation; or any compatible license.

See http://dev.perl.org/licenses/ for more information.