Revision history for DBIx::Class::UUIDColumns
+0.02005 Sun June 22 23:10:23 2008
+ - Added support for UUID::Random - Moritz Onken
+
0.02004 Mon Apr 22 20:41:23 2008
- Fix test failure under SQL::Translator <= 0.07
- Removed Build.PL now that Module::Install no longer supports it
!eval 'require UUID' &&
!eval 'require Win32::Guidgen' &&
!eval 'require Win32API::GUID' &&
- !eval 'require Data::Uniqid'
+ !eval 'require Data::Uniqid' &&
+ !eval 'require UUID::Random'
) {
requires 'Data::UUID';
};
recommends 'UUID';
recommends 'Win32::Guidgen';
recommends 'Win32API::GUID';
+recommends 'UUID::Random';
tests 't/*.t';
clean_files "DBIx-Class-UUIDColumns-* t/var";
# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
# brain damage and presumably various other packaging systems too
-$VERSION = '0.02004';
+$VERSION = '0.02005';
sub uuid_columns {
my $self = shift;
return '::Win32::Guidgen';
} elsif (eval{require Win32API::GUID}) {
return '::Win32API::GUID';
+ } elsif (eval{require UUID::Random}) {
+ return '::UUID::Random';
} else {
die 'no suitable uuid module could be found for use with DBIx::Class::UUIDColumns';
};
--- /dev/null
+package DBIx::Class::UUIDColumns::UUIDMaker::UUID::Random;
+
+use strict;
+use warnings;
+
+use base qw/DBIx::Class::UUIDColumns::UUIDMaker/;
+use UUID::Random ();
+
+sub as_string {
+ return UUID::Random::generate;
+};
+
+1;
+__END__
+
+=head1 NAME
+
+DBIx::Class::UUIDColumns::UUIDMaker::UUID::Random - Create uuids using UUID::Random
+
+=head1 SYNOPSIS
+
+ package Artist;
+ __PACKAGE__->load_components(qw/UUIDColumns Core DB/);
+ __PACKAGE__->uuid_columns( 'artist_id' );
+ __PACKAGE__->uuid_class('::UUID::Random');
+
+=head1 DESCRIPTION
+
+This DBIx::Class::UUIDColumns::UUIDMaker subclass uses UUID::Random to generate
+uuid strings using UUID::Random::generate.
+
+=head1 METHODS
+
+=head2 as_string
+
+Returns the new uuid as a string.
+
+=head1 SEE ALSO
+
+L<UUID::Random>
+
+=head1 AUTHOR
+
+Moritz Onken <onken@houseofdesign.de>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
all_pod_files_spelling_ok();
__DATA__
+Moritz
+Onken
uuid
uuids
Chia
BEGIN {
use lib 't/lib';
- use DBIC::Test tests => 13;
+ use DBIC::Test tests => 14;
};
my $schema = DBIC::Test->init_schema;
ok $row->id, 'got something from Data::Uniqid';
};
+SKIP: {
+ skip 'UUID::Random not installed', 1 unless eval 'require UUID::Random';
+
+ DBIC::Test::Schema::Test->uuid_class('::UUID::Random');
+ Class::C3->reinitialize();
+ $row = $schema->resultset('Test')->create({ });
+ ok $row->id, 'got something from UUID::Random';
+};
+
eval {
DBIC::Test::Schema::Test->uuid_class('::JunkIDMaker');
};