DBIx::...ntarray(3pm)
β¨ NAME β¨
DBIx::Class::Helper::ResultSet::IgnoreWantarray β bestie, this is the one that gets rid of your search context issues π
(also lowkey known by its truncated little nickname DBIx::...ntarray(3pm) in the manual header, but we don't gatekeep, we use the full name π«Ά)
πΈ SYNOPSIS πΈ
okay so first you gotta load the component into your ResultSet class:
package MyApp::Schema::ResultSet::Foo;
__PACKAGE__->load_components(qw{Helper::ResultSet::IgnoreWantarray});
...
1;
and then somewhere else, like in a controller (no thoughts, just vibes):
my $rs = $self->paginate(
$schema->resultset('Foo')->search({
name => 'frew'
})
);
π¦ DESCRIPTION π¦
so here's the tea β β this component makes search always return a ResultSet. Always. No exceptions. Instead of being all "hmm, are we in array context? then here's an array of your database β¨" like it usually does, it justβ¦ doesn't. It stays a ResultSet. Periodt.
why do we care? because array-context search is exactly the kind of thing that ruins your whole day when you were just trying to chain methods. not on our watch π
if you wanna apply this to your entire schema (iconic move, honestly), go peek at "NOTE" in DBIx::Class::Helper::ResultSet β it shows you a nice way to do it π
π METHODS π
π§ search
this is an override of the default search method, and its whole job is forcing it to return a ResultSet. that's it. that's the method. it understood the assignment π«‘
π AUTHOR π
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2024 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay bestie that's the whole page, go forth and slay your result sets π β¨
cute little sign-off time: this gorgeous little doc is perl v5.40.0, dated 2024-11-16, and it lives under the name DBIx::...ntarray(3pm) in the manual pages. no cap ππ¦π
π¦ where this page comes from
- debian trixie: libdbix-class-helpers-perl 2.037000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-class-helpers-perl 2.037000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-class-helpers-perl 2.037000-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