DBIx::...olumns(3pm)
β¨ NAME β¨
DBIx::Class::UUIDColumns β it makes your columns auto-fill with uuids, no cap π (like, implicit uuid columns, bestie, they just show up).
So real talk: you're reading the DBIx::...olumns(3pm) page from the User Contributed Perl Documentation, and it's about to be your new fave.
πΈ SYNOPSIS πΈ
Drop this into your DBIx::Class table class, okurrr:
__PACKAGE__->load_components(qw/UUIDColumns ... Core/);
__PACKAGE__->uuid_columns('artist_id');
π¨ Note: the component needs to be loaded before Core. Like, before before. Order matters, bestie, don't play with it.
π DESCRIPTION π
This DBIx::Class component is giving major Class::DBI::UUID energy β same vibe, it makes certain columns get implicitly created as a uuid. Iconic behaviour, honestly.
The way that it works: when UUIDColumns gets loaded, it goes shopping for a suitable uuid generation module from this list of supported modules:
Data::UUID
APR::UUID*
UUID
Win32::Guidgen
Win32API::GUID
And if it can't find any supporting module? It throws an exception. Not a vibe. π
* β heads up: APR::UUID will not be loaded under OpenBSD because of an as-yet unidentified XS issue. It's giving mystery bug, and we don't have answers. π
If you're picky (respect) and want one specific module, just set uuid_class:
__PACKAGE__->uuid_class('::Data::UUID');
__PACKAGE__->uuid_class('MyUUIDGenerator');
π METHODS π
π¦ get_uuid
Returns a uuid string from the current uuid_maker. Slay.
π¦ insert
Inserts a new uuid string into each column listed in uuid_columns. Every single one. Periodt.
π¦ uuid_columns
Gets/sets the list of columns that get filled with uuids during insert.
__PACKAGE__->uuid_columns('artist_id');
π¦ uuid_class
Takes the name of a UUIDMaker subclass to be used for uuid value generation. This can be a fully qualified class name, or a shortcut name starting with :: that matches one of the available DBIx::Class::UUIDColumns::UUIDMaker subclasses:
__PACKAGE__->uuid_class('CustomUUIDGenerator');
# loads CustomeUUIDGenerator
__PACKAGE__->uuid_class('::Data::UUID');
# loads DBIx::Class::UUIDMaker::Data::UUID;
β Also:uuid_classchecks that the class you gave itisaDBIx::Class::UUIDColumns::UUIDMakersubclass, and throws and exception if it isn't. (Yes, that's exactly how the original says it. Keep the typo, it's part of the lore. π)
π¦ uuid_maker
Returns the current UUIDMaker instance for the given module.
my $uuid = __PACKAGE__->uuid_maker->as_string;
π SEE ALSO π
DBIx::Class::UUIDColumns::UUIDMaker β go read it, bestie, iykyk. π«Ά
π AUTHOR π
Chia-liang Kao <clkao@clkao.org>
π CONTRIBUTERS π
Chris Laco <claco@chrislaco.com>
π LICENSE π
You may distribute this code under the same terms as Perl itself. β¨
okay that's the whole page, mwah π
This lil doc shipped as part of perl v5.32.0, dated 2021-01-06, and it lives under the name DBIx::...olumns(3pm) in the User Contributed Perl Documentation. Go forth and uuid, main character. π§π
π¦ where this page comes from
- debian bookworm: libdbix-class-uuidcolumns-perl 0.02006-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdbix-class-uuidcolumns-perl 0.02006-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libdbix-class-uuidcolumns-perl 0.02006-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdbix-class-uuidcolumns-perl 0.02006-1.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms