[Bast-commits] r4510 - in trunk/DBIx-Class-UUIDColumns: .
lib/DBIx/Class lib/DBIx/Class/UUIDColumns/UUIDMaker
lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID t
claco at dev.catalyst.perl.org
claco at dev.catalyst.perl.org
Mon Jun 23 04:12:47 BST 2008
Author: claco
Date: 2008-06-23 04:12:45 +0100 (Mon, 23 Jun 2008)
New Revision: 4510
Added:
trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID/
trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID/Random.pm
Modified:
trunk/DBIx-Class-UUIDColumns/
trunk/DBIx-Class-UUIDColumns/Changes
trunk/DBIx-Class-UUIDColumns/Makefile.PL
trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns.pm
trunk/DBIx-Class-UUIDColumns/t/pod_spelling.t
trunk/DBIx-Class-UUIDColumns/t/uuid.t
Log:
r1684 at mbp: claco | 2008-06-22 23:11:52 -0400
Added UUID::Random support.
Property changes on: trunk/DBIx-Class-UUIDColumns
___________________________________________________________________
Name: svk:merge
- 58586828-bfeb-4a8b-ac3c-3302daf284f8:/local/DBIx-Class-UUIDColumns:1536
d21250e9-0eb8-4cf9-8d68-8684fda3ee2b:/local/DBIx-Class-UUIDColumns:1638
e19faa6c-ac33-4258-b272-ecd763fae5b6:/local/DBIx-Class-UUIDColumns:30
+ 58586828-bfeb-4a8b-ac3c-3302daf284f8:/local/DBIx-Class-UUIDColumns:1684
d21250e9-0eb8-4cf9-8d68-8684fda3ee2b:/local/DBIx-Class-UUIDColumns:1638
e19faa6c-ac33-4258-b272-ecd763fae5b6:/local/DBIx-Class-UUIDColumns:30
Modified: trunk/DBIx-Class-UUIDColumns/Changes
===================================================================
--- trunk/DBIx-Class-UUIDColumns/Changes 2008-06-21 17:21:22 UTC (rev 4509)
+++ trunk/DBIx-Class-UUIDColumns/Changes 2008-06-23 03:12:45 UTC (rev 4510)
@@ -1,5 +1,8 @@
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
Modified: trunk/DBIx-Class-UUIDColumns/Makefile.PL
===================================================================
--- trunk/DBIx-Class-UUIDColumns/Makefile.PL 2008-06-21 17:21:22 UTC (rev 4509)
+++ trunk/DBIx-Class-UUIDColumns/Makefile.PL 2008-06-23 03:12:45 UTC (rev 4510)
@@ -16,7 +16,8 @@
!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';
};
@@ -30,6 +31,7 @@
recommends 'UUID';
recommends 'Win32::Guidgen';
recommends 'Win32API::GUID';
+recommends 'UUID::Random';
tests 't/*.t';
clean_files "DBIx-Class-UUIDColumns-* t/var";
Added: trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID/Random.pm
===================================================================
--- trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID/Random.pm (rev 0)
+++ trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID/Random.pm 2008-06-23 03:12:45 UTC (rev 4510)
@@ -0,0 +1,48 @@
+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 at houseofdesign.de>
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
Modified: trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns.pm
===================================================================
--- trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns.pm 2008-06-21 17:21:22 UTC (rev 4509)
+++ trunk/DBIx-Class-UUIDColumns/lib/DBIx/Class/UUIDColumns.pm 2008-06-23 03:12:45 UTC (rev 4510)
@@ -14,7 +14,7 @@
# 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;
@@ -78,6 +78,8 @@
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';
};
Modified: trunk/DBIx-Class-UUIDColumns/t/pod_spelling.t
===================================================================
--- trunk/DBIx-Class-UUIDColumns/t/pod_spelling.t 2008-06-21 17:21:22 UTC (rev 4509)
+++ trunk/DBIx-Class-UUIDColumns/t/pod_spelling.t 2008-06-23 03:12:45 UTC (rev 4510)
@@ -20,6 +20,8 @@
all_pod_files_spelling_ok();
__DATA__
+Moritz
+Onken
uuid
uuids
Chia
Modified: trunk/DBIx-Class-UUIDColumns/t/uuid.t
===================================================================
--- trunk/DBIx-Class-UUIDColumns/t/uuid.t 2008-06-21 17:21:22 UTC (rev 4509)
+++ trunk/DBIx-Class-UUIDColumns/t/uuid.t 2008-06-23 03:12:45 UTC (rev 4510)
@@ -5,7 +5,7 @@
BEGIN {
use lib 't/lib';
- use DBIC::Test tests => 13;
+ use DBIC::Test tests => 14;
};
my $schema = DBIC::Test->init_schema;
@@ -85,6 +85,15 @@
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');
};
More information about the Bast-commits
mailing list