[Dbix-class] DBIx::Class::UUIDColumns Bretherin
Christopher H. Laco
claco at chrislaco.com
Mon Nov 21 22:58:26 CET 2005
Would you be interested in some patches for different
DBIx::Class::UUIDColumns classes, or just to tweak UUIDColumn?
I'm toying with DBIx::Class again in Handel, and I use uuid as primary
keys everywhere. Using DBIx::Class::UUIDColumns would make more sense,
but it's based on Data::UUID which isn't cross platform (well yes,
there's win32 patch, but it's an unknown at this point; the same reason
I didn't use Class::DBI::UUID). When Handel loads, I currently do some
magic to find the best thing:
> my $uuidsub;
>
> if (eval{require APR::UUID}) {
> $uuidsub = sub {
> return APR::UUID->new->format;
> };
> } elsif (eval{require UUID}) {
> $uuidsub = sub {
> my ($uuid, $uuidstring);
> UUID::generate($uuid);
> UUID::unparse($uuid, $uuidstring);
>
> return $uuidstring;
> };
> } elsif (eval{require Data::UUID}) {
> $uuidsub = sub {
> my $ug = Data::UUID->new;
> my $uuid = $ug->create;
>
> return $ug->to_string($uuid);
> };
> } elsif (eval{
> # for some reason 'no warnings' won't squelch
> # the 'too late for INIT' warning in Win32::API::Type
> local $^W = 0;
> require Win32::Guidgen;
> }) {
> $uuidsub = sub {
> return Win32::Guidgen::create();
> };
> } elsif (eval{require Win32API::GUID}) {
> $uuidsub = sub {
> return Win32API::GUID::CreateGuid();
> };
> } else {
> throw Handel::Exception(
> -text => 'Required modules not found',
> -details => 'UUID/Data::UUID'
> );
> };
> *Handel::newuuid = $uuidsub;
Until Data::UUID really does work cross platform, could we do something
similiar to UUIDColumns, Maybe just two modules, not all of them?
-=Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20051121/56831c0e/smime-0001.bin
More information about the Dbix-class
mailing list