Test2:...n::UUID(3pm)

πŸ“¦
version 0.002010 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– 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 the UUID cpan module, BUT it has to be version 0.35 or 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_WARN environment 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_WARN environment 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 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