Catman...::UUID(3pm)

πŸ“¦
version 1.16 Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– Catmandu::DirectoryIndex::UUID πŸ’–

okay so bestie, this page is Catmandu::DirectoryIndex::UUID(3pm), straight out of the User Contributed Perl Documentation collection, and it's giving "tiny module, big opinions about where your files live." Let's get into it 🫢


✨ NAME ✨

Catmandu::DirectoryIndex::UUID β€” a uuid based path translator. that's it, that's the whole job, and it does it flawlessly πŸ’…


🌸 SYNOPSIS 🌸

use Catmandu::DirectoryIndex::UUID;

my $p = Catmandu::DirectoryIndex::UUID->new(
    base_dir => "/data"
);

# Returns mapping like { _id  => "9A581C80-1189-11E8-AB6D-46BC153F89DB", "/data/9A5/81C/80-/118/9-1/1E8/-AB/6D-/46B/C15/3F8/9DB" }
# Can be undef
my $mapping = $p->get("9A581C80-1189-11E8-AB6D-46BC153F89DB");

# Create path and return mapping
my $mapping = $p->add("9A581C80-1189-11E8-AB6D-46BC153F89DB");

# Catmandu::DirectoryIndex::Number is a Catmandu::Iterable
# Returns list of records: [{ _id => 1234, _path => "/data/000/001/234" }]
my $mappings = $p->to_array();

like look at that. you hand it a UUID, it hands you back a whole little nested directory tree situation. the way get can just hit you with undef though 😭 stay safe out there.


πŸ’… METHODS πŸ’…

πŸŽ€ new( base_dir => $base_dir )

build yourself a brand new Catmandu::DirectoryIndex::UUID, no cap. it takes these configuration parameters:

  • base_dir β€” see Catmandu::DirectoryIndex. that's the whole list, she's low maintenance ✨

πŸ’€ LIMITATIONS πŸ’€

the keys in this directory can only be UUID identifiers. periodt. don't try to sneak a random string in there, bestie, she will not be accepting that πŸ™ˆ

πŸ‘‘ INHERITED METHODS πŸ‘‘

this Catmandu::DirectoryIndex::Number implements:

  • Catmandu::DirectoryIndex

(yes, that's literally what the page says. i'm just the messenger 🧚)


πŸ¦‹ SEE ALSO πŸ¦‹

  • Catmandu::DirectoryIndex β€” go read this one too, it's the main character and this module is its little sister πŸ’œ

and that's the whole vibe check, bestie. this was Catmandu::DirectoryIndex::UUID(3pm) from perl v5.36.0, dated 2022-12-10 β€” slay, ate, no crumbs left 🌈⭐ πŸ’–

πŸ“¦ where this page comes from