Merge 'trunk' into 'DBIx-Class-current'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / UUIDMaker / UUID.pm
1 package DBIx::Class::UUIDMaker::UUID;
2 use base qw/DBIx::Class::UUIDMaker/;
3 use UUID ();
4
5 sub as_string {
6     my ($uuid, $uuidstring);
7     UUID::generate($uuid);
8     UUID::unparse($uuid, $uuidstring);
9
10     return $uuidstring;
11 };
12
13 1;
14 __END__
15
16 =head1 NAME
17
18 DBIx::Class::UUIDMaker::UUID - Create uuids using UUID
19
20 =head1 SYNOPSIS
21
22   package Artist;
23   __PACKAGE__->load_components(qw/UUIDColumns Core DB/);
24   __PACKAGE__->uuid_columns( 'artist_id' );
25   __PACKAGE__->uuid_class('::UUID');
26
27 =head1 DESCRIPTION
28
29 This DBIx::Class::UUIDMaker subclass uses UUID to generate uuid
30 strings in the following format:
31
32   098f2470-bae0-11cd-b579-08002b30bfeb
33
34 =head1 METHODS
35
36 =head2 as_string
37
38 Returns the new uuid as a string.
39
40 =head1 SEE ALSO
41
42 L<UUID>
43
44 =head1 AUTHOR
45
46 Chris Laco <claco@chrislaco.com>
47
48 =head1 LICENSE
49
50 You may distribute this code under the same terms as Perl itself.