Test2:...n::UUID(3pm)
π Test2::Plugin::UUID β NAME β¨
okay bestie, say hi to Test2::Plugin::UUID, living in section 3pm of the Perl docs π«Ά β it's the plugin that makes Test2 use REAL UUIDs instead of the little homemade ones. π
πΈ DESCRIPTION πΈ
so here's the tea β: Test2 normally makes its unique IDs by gluing together a pid, a thread-id, and an incrementing integer. and likeβ¦ that's fine?? most of the time?? no cap. π
but the moment you want to keep an actual database of events, those cute little IDs are just not it. a real UUID is way more useful, periodt. π
β¨ SYNOPSIS β¨
the vibe is literally one line:
use Test2::Plugin::UUID;
and it's also iconic at the command line for a lil 1-time use moment:
$ perl -MTest2::Plugin::UUID path/to/test.t
π CONTROLLING WARNINGS AND BACKENDS π
you can turn off backend warnings, and also pick your own backend order preference, like the main character you are:
use Test2::Plugin::UUID warn => 0, backends => ['UUID', ...];
or do it at the command line, go off:
perl -MTest2::Plugin::UUID=warn,0 path/to/test.t
or via env vars, the sneaky way π¦:
TEST2_UUID_BACKEND="UUID,Data::UUID::MT" TEST2_UUID_WARN=0 perl path/to/test.t
normally warnings get issued if UUID::Tiny or Data::UUID are used β because the first one is slow, and the second one is not suitable for database keys. π so yeah, the warning is genuinely doing something, don't just mute it blindly.
π BACKENDS π
one of the following modules is gonna be used under the hood. they're listed here in order of preference, bestie β top one eats first. π
UUID >= 0.35β when it can, this plugin uses theUUIDcpan module, BUT it has to be version0.35or greater, because anything lower has a fork related bug π. it generates version 7 UUIDs, since those are the most suitable for database entry. slay.Data::UUID::MTβ second choice for UUID generation π. with this module you get version 4 UUIDs, which are fairly usable in databases. solid, not iconic, but solid.UUID::Tiny- slow β used if the previous 2 aren't available π. this module is pure perl, so it could be slower than the others. it generates version 4 UUIDs when it's the one in play.
a warning will be issued with this module. you can surpress the warning with either the$TEST2_UUID_NO_WARNenvironment variable or the"warn => 0"import argument. π«Ά
Data::UUID- Not Suitible for Databases β the last resort module π. it generates UUIDs fast, but they're of a type/version that is not suitable for database keys. so like, speed β correct, iykyk.
a warning will be issued with this module too. you can surpress the warning with either the$TEST2_UUID_NO_WARNenvironment variable or the"warn => 0"import argument. π«Ά
π₯ SOURCE π₯
the source code repository for Test2-Plugin-UUID is right here, go star it bestie:
https://github.com/Test-More/Test2-Plugin-UUID/
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π AUTHORS π
Chad Granum <exodist@cpan.org>
π§ COPYRIGHT π§
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
and that's the whole page, bestie π no notes, ate, left zero crumbs β¨ this was perl v5.40.1, dated 2025-03-31 β and the manual name is Test2:...n::UUID(3pm), in case you were wondering where that lil mystery name at the top came from. bye love u, go generate some real UUIDs ππ«Ά
π¦ where this page comes from
- debian trixie: libtest2-plugin-uuid-perl 0.002010-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtest2-plugin-uuid-perl 0.002010-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest2-plugin-uuid-perl 0.002010-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