Commit | Line | Data |
cbf59b95 |
1 | NAME |
2 | DBIx::Class::UUIDColumns - Implicit uuid columns |
3 | |
4 | SYNOPSIS |
5 | package Artist; |
6 | __PACKAGE__->load_components(qw/UUIDColumns Core DB/); |
7 | __PACKAGE__->uuid_columns( 'artist_id' ); |
8 | |
9 | DESCRIPTION |
10 | This DBIx::Class component resembles the behaviour of Class::DBI::UUID, |
11 | to make some columns implicitly created as uuid. |
12 | |
13 | When loaded, "UUIDColumns" will search for a suitable uuid generation |
14 | module from the following list of supported modules: |
15 | |
16 | Data::UUID |
17 | APR::UUID* |
18 | UUID |
19 | Win32::Guidgen |
20 | Win32API::GUID |
21 | |
22 | If no supporting module can be found, an exception will be thrown. |
23 | |
24 | *APR::UUID will not be loaded under OpenBSD due to an as yet |
25 | unidentified XS issue. |
26 | |
27 | If you would like to use a specific module, you can set "uuid_class": |
28 | |
29 | __PACKAGE__->uuid_class('::Data::UUID'); |
30 | __PACKAGE__->uuid_class('MyUUIDGenerator'); |
31 | |
32 | Note that the component needs to be loaded before Core. |
33 | |
34 | METHODS |
35 | uuid_columns(@columns) |
36 | Takes a list of columns to be filled with uuids during insert. |
37 | |
38 | __PACKAGE__->uuid_columns('id'); |
39 | |
40 | uuid_class($classname) |
41 | Takes the name of a UUIDMaker subclass to be used for uuid value |
42 | generation. This can be a fully qualified class name, or a shortcut name |
43 | starting with :: that matches one of the available |
44 | DBIx::Class::UUIDMaker subclasses: |
45 | |
46 | __PACKAGE__->uuid_class('CustomUUIDGenerator'); |
47 | # loads CustomeUUIDGenerator |
48 | |
49 | __PACKAGE->uuid_class('::Data::UUID'); |
50 | # loads DBIx::Class::UUIDMaker::Data::UUID; |
51 | |
52 | Note that "uuid_class" chacks to see that the specified class isa |
53 | DBIx::Class::UUIDMaker subbclass and throws and exception if it isn't. |
54 | |
55 | uuid_maker |
56 | Returns the current UUIDMaker instance for the given module. |
57 | |
58 | my $uuid = __PACKAGE__->uuid_maker->as_string; |
59 | |
60 | SEE ALSO |
61 | DBIx::Class::UUIDMaker |
62 | |
63 | AUTHORS |
64 | Chia-liang Kao <clkao@clkao.org> Chris Laco <claco@chrislaco.com> |
65 | |
66 | LICENSE |
67 | You may distribute this code under the same terms as Perl itself. |
68 | |