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