Fixed case where no uuid module found so that it dies with error, not with method...
[dbsrgits/DBIx-Class-UUIDColumns.git] / t / lib / UUIDTest.pm
CommitLineData
773544fd 1package # hide from PAUSE
2 UUIDTest;
3
4use strict;
5use warnings;
6use UUIDTest::Schema;
7
8sub initialise {
9
10 my $db_file = "t/var/UUIDTest.db";
11
12 unlink($db_file) if -e $db_file;
13 unlink($db_file . "-journal") if -e $db_file . "-journal";
14 mkdir("t/var") unless -d "t/var";
15
16 my $dsn = "dbi:SQLite:${db_file}";
17
18 return UUIDTest::Schema->compose_connection('UUIDTest' => $dsn);
19}
20
21sub is_uuid {
22 my $value = defined $_[0] ? shift : '';
23
24 return ($value =~ m/ ^[0-9a-f]{8}-
25 [0-9a-f]{4}-
26 [0-9a-f]{4}-
27 [0-9a-f]{4}-
28 [0-9a-f]{12}$
29 /ix);
30};
31
321;