DBIx::...:Union(3pm)

πŸ‘‘ DBIx::SearchBuilder::Union β€” the manual page, but make it a group chat

okay bestie, gather round, because this is DBIx::SearchBuilder::Union from the User Contributed Perl Documentation corner of the universe, and it is exactly what it sounds like: it lets you take a whole bunch of SearchBuilder result sets and treat them like one single collection. it's giving "two searches, one list" energy and honestly? iconic. πŸ’–


✨ NAME ✨

DBIx::SearchBuilder::Union β€” Deal with multiple SearchBuilder result sets as one 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

like, look how cute this is:

use DBIx::SearchBuilder::Union;
my $U = new DBIx::SearchBuilder::Union;
$U->add( $tickets1 );
$U->add( $tickets2 );

$U->GotoFirstItem;
while (my $z = $U->Next) {
  printf "%5d %30.30s\n", $z->Id, $z->Subject;
}

yes bestie, that's the whole vibe. add your collections, GotoFirstItem, then just Next your way into the sunset. πŸŒ…

⚠️ WARNING ⚠️

This module is still experimental. πŸ’€

not me being the responsible one for once β€” fr fr, tread lightly, it's still cooking.

🌸 DESCRIPTION 🌸

so here's the tea: this module implements a subset of the DBIx::SearchBuilder collection methods. not all of them β€” just enough to do iteration over a bunch of results. ✨

and why would you want that? because it's useful for displaying the results of two unrelated searches (for the same kind of objects) in a single list. that's it, that's the whole point, and it ate. πŸ‘‘

πŸ’… METHODS πŸ’…

new

Create a new DBIx::SearchBuilder::Union object. No arguments. that's it. no parameters, no drama, no situationship. just vibes. πŸŽ€

add $sb

Add a searchbuilder result (collection) to the Union object. πŸ’«

It must be the same type as the first object added.

like, the first one sets the standard and everyone else has to match. main character energy, honestly. πŸ™ˆ

First

Return the very first element of the Union (which is the first element of the first Collection). Also reset the current pointer to that element. 🏁

two jobs, zero complaints.

Next

Return the next element in the Union. ➑️

the one you'll be calling in a while loop forever, iykyk.

Last

Returns the last item 🏁✨

Count

Returns the total number of elements in the Union'ed Collection πŸ”’

yes she counts everything, across all the collections. no element left behind.

GotoFirstItem

Starts the recordset counter over from the first item. the next time you call Next, you'll get the first item returned by the database, as if you'd just started iterating through the result set. πŸ”„

it's a rewind button, bestie. just press it.

IsLast

Returns true if the current row is the last record in the set. βœ…

the "am I at the end?" check, so you don't have to guess.

ItemsArrayRef

Return a reference to an array containing all objects found by this search. πŸ“¦

Will destroy any positional state. 😭

okay so real talk: if you had a cursor position going, it is gone. it's a full reset. don't call this mid-iteration unless you're cool with starting over. periodt.


and that's the whole page, bestie. no cap, every method, every caveat, every warning β€” all accounted for. πŸ’–

this little masterpiece is documented as DBIx::...:Union(3pm), perl v5.40.1, dated 2026-05-07. slay, go union your searches. byeee πŸ¦‹πŸŒˆβœ¨

πŸ“¦ where this page comes from