DBIx::...Update(3pm)
π DBIx::Class::Helper::Row::ProxyResultSetUpdate π
okay bestie, gather round, because this one is a lil module with big main character energy. it lives in the DBIx::Class::Helper::Row::ProxyResultSetUpdate corner of the Perl universe (User Contributed Perl Documentation, if you're keeping receipts), and it's about letting your Result reuse the update logic you already wrote in your ResultSet. no cap. π¦
β¨ SYNOPSIS β¨
so first, the ResultSet β you write your update however you want, and this is the moment:
package MyApp::Schema::ResultSet::Foo;
use parent 'DBIx::Class::ResultSet';
sub update {
my ($self, $data) = @_;
die 'you fool!' if $data->{name} eq 'fool';
return $self->next::method($data);
}
(yes, it really does die 'you fool!'. iconic behavior honestly π)
then the Result:
package MyApp::Schema::Result::Foo;
use parent 'DBIx::Class::Core';
__PACKAGE__->load_components(qw( Helper::Row::ProxyResultSetUpdate ));
...
or, if you're a DBIx::Class::Candy girlie:
package MyApp::Schema::Result::Foo;
use DBIx::Class::Candy -components => ['Helper::Row::ProxyResultSetMethod'];
...
πΈ DESCRIPTION πΈ
okay so here's the tea β. This module makes reusing resultset updates from a result trivially easy. Like, literally trivial. β¨
the way that people usually share update methods? they override update in their resultset and route it through "update_all" in DBIx::Class::ResultSet. and unfortunately β and I cannot stress this enough β that can end up being wildly inefficient. π
instead: if you can write your update in terms of the resultset, you can make your code much faster and more efficient. that's it, that's the whole vibe. ate. π
π 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.
and that's the whole page bestie π«Ά shoutout to perl v5.40.0, dated 2024-11-16, served up fresh from the User Contributed Perl Documentation collection. go forth and proxy those resultset updates, you absolute icon. βπ§π
π¦ 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