DBIx::...et::Me(3pm)

πŸ“¦
version 2.037000 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– 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> πŸ’–


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 from perl v5.40.0, dated 2024-11-16, and it was brought to you by the fine folks over at DBIx::...et::Me(3pm). go forth and define your searches nicely. mwah. 😭🫢✨
πŸ“¦ where this page comes from