DBIx::...et::Me(3pm)
π DBIx::...et::Me(3pm) π
okay bestie, so this manual page is literally called DBIx::...et::Me(3pm) and it's all about the module DBIx::Class::Helper::ResultSet::Me π β it's a Perl thing, it lives in the User Contributed Perl Documentation, and it's about making your predefined searches look cute instead of cursed. buckle up. π
β¨ NAME β¨
DBIx::Class::Helper::ResultSet::Me β define predefined searches, but more nicely. that's it. that's the whole vibe. π
π¦ SYNOPSIS π¦
heads up bestie: normally this is a component for a ResultSet, not a standalone thing. iykyk.
# note that this is normally a component for a ResultSet
package MySchema::ResultSet::Bar;
use strict;
use warnings;
use parent 'DBIx::Class::ResultSet';
use constant CANDY => 1;
__PACKAGE__->load_components('Helper::ResultSet::Me');
sub candy {
$_[0]->search({ $_[0]->me.'type' => CANDY })
}
sub cake {
$_[0]->search({ $_[0]->me('type') => CAKE })
}
# in code using resultset:
my $candy_bars = $schema->resultset('Bar')->candy;
my $cake_bars = $schema->resultset('Bar')->cake;
likeβ¦ look at that. ->candy and ->cake. no chaos. no string-soup. just vibes. πβ¨
πΈ DESCRIPTION πΈ
so this component gives you a slightly nicer way to write predefined search definitions. that's the whole point. that's the mission. π«Ά
if you wanna apply it to your entire schema, go peek at "NOTE" in DBIx::Class::Helper::ResultSet β that's the nice way to do it, no cap.
it defines a single method β one!! β that's shorter and (to most people, fr fr) clearer than current_source_alias in DBIx::Class::ResultSet, which is, btw, exactly what it uses under the hood for the me method. it's giving "elegant wrapper", and honestly? it ate. π
π METHODS π
π me
merely returns the SQL namespace for the current search β with a . at the end of it, bestie, don't forget the dot β¨ β so internal resultset methods can be defined with $self->me instead of $self->current_source_alias . q(.). so much typing saved. so much slay.
also!! if you pass it a single argument, it will append that argument to the returned string. that's it. that's the whole method. iconic behaviour, zero notes. π
π§ 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. periodt. π
and that's the whole page, bestie!! π this version came fromperl v5.40.0, dated 2024-11-16, and it was brought to you by the fine folks over atDBIx::...et::Me(3pm). go forth and define your searches nicely. mwah. ππ«Άβ¨
π¦ 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