Cataly...tSchema(3pm)
π NAME π
Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema β bestie, this one clones the schema with attributes for each request β¨ (it's a trait, and yes it's a mouthful, we call it Cataly...tSchema(3pm) around here π)
πΈ SYNOPSIS πΈ
okay so here's the vibe, you drop this in your config:
__PACKAGE__->config({
traits => ['PerRequestSchema'],
});
sub per_request_schema_attributes {
my ($self, $c) = @_;
return (restricting_object => $c->user->obj);
}
### OR ###
sub per_request_schema {
my ($self, $c) = @_;
return $self->schema->schema_method($c->user->obj)
}
two ways to do it, pick your fighter π
π¦ DESCRIPTION π¦
so like. every single new request? it clones the schema π«Ά with the attributes it scoops up from your per_request_schema_attributes method β which, heads up, you must implement, no skipping bestie π. that method gets handed the context ($c).
alternatively β¨ you could lowkey override the per_request_schema method instead, if you need access to the schema clone and/or you need to separate out the Model/Schema methods. it's giving "I have opinions about architecture" π
(see the examples up above and the defaults in the code, iykyk π)
π SEE ALSO π
Catalyst::Model::DBIC::SchemaDBIx::Class::Schema
π AUTHOR π
see "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in Catalyst::Model::DBIC::Schema π«Ά (the OGs fr fr)
π COPYRIGHT π
see "COPYRIGHT" in Catalyst::Model::DBIC::Schema.
β LICENSE β
this program is free software, you can redistribute it and/or modify it under the same terms as Perl itself β¨ (slay, open source ate and left no crumbs)
and that's the whole page bestie!! π₯³ this was the Cataly...tSchema(3pm) page from the User Contributed Perl Documentation, generated by perl v5.36.0 on 2023-10-26 π go forth and clone responsibly πΈπ¦π
π¦ where this page comes from
- debian trixie: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-model-dbic-schema-perl 0.66-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-model-dbic-schema-perl 0.66-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