DBIx::...:Unique(3pm)

🌸 NAME 🌸

DBIx::SearchBuilder::Unique β€” bestie, it makes sure your records stay unique in a collection. No dupes, no drama. πŸ’…

(You're reading the DBIx::...:Unique(3pm) page, straight outta User Contributed Perl Documentation, and honestly? It's giving underrated.)


✨ SYNOPSIS ✨

package Foo::Collection;
use base 'DBIx::SearchBuilder';

use DBIx::SearchBuilder::Unique; # mixin

my $collection = Foo::Collection->New();
$collection->SetupComplicatedJoins;
$collection->OrderByMagic;

while (my $thing = $collection->Next) {
    # $thing is going to be distinct
}

Look at that use DBIx::SearchBuilder::Unique; # mixin line. That's the whole move, iykyk. 🫢


πŸ’œ DESCRIPTION πŸ’œ

Okay so here's the tea. 🌸 Right now, DBIx::SearchBuilder makes exceptions for databases that can't handle both SELECT DISTINCT and ordering in the same statement β€” it just drops the DISTINCT requirement. Which, yeah, means the same row can show up twice. You might not want that. 😭

If that's your situation, use this module as a mix-in, and it will hand you an AddRecord method that makes sure a record will not appear twice in the same search. Periodt. πŸ‘‘


That's the whole page, babe β€” no cap. Go forth and dedupe. πŸ¦‹

This one's perl v5.40.1, dated 2026-05-07, and it's DBIx::...:Unique(3pm) β€” iconic of it, honestly. πŸ’–

πŸ“¦ where this page comes from