Maypole...DBI::DFV(3)
Maypole::Model::CDBI::DFV π
okay bestie, so this is a page from the User Contributed Perl Documentation section of the manual, and it's all about Maypole::Model::CDBI::DFV β the Class::DBI::DFV model for Maypole. yes we're doing old-school Perl web frameworks today and honestly? iconic. π
β¨ NAME β¨
Maypole::Model::CDBI::DFV β it's the Class::DBI::DFV model for Maypole. that's the whole name, periodt. π
πΈ SYNOPSIS πΈ
like here's the whole vibe, look:
package Foo;
use 'Maypole::Application';
Foo->config->model("Maypole::Model::CDBI::DFV");
Foo->setup([qw/ Foo::SomeTable Foo::Other::Table /]);
# Look ma, no untainting
sub Foo::SomeTable::SomeAction : Exported {
. . .
}
look ma, no untainting β the comment is literally in the source and honestly it's giving main character energy. π«Ά
π¦ DESCRIPTION π¦
so this module is the glow-up that lets you use Maypole with Class::DBI classes you already set up that use Class::DBI::DFV. no cap.
all you gotta do is call setup with a list reference of the classes you're gonna use, and Maypole will work out the tables and set up all the inheritance relationships as normal. she just knows. π§
and better still?? it will also use your DFV profile to validate input instead of CGI::Untaint. for teh win!! π (the original really does say "teh win" and we respect the heritage)
π METHODS π
setup
this method is inherited from Maypole::Model::Base, and it calls setup_database, which uses Class::DBI::Loader to create and load Class::DBI classes from the given database schema. chain of command, love to see it. β¨
setup_database
this method loads the model classes for the application. that's it. that's the job. π
class_of
returns the class for a given table. short, sweet, slay. π
adopt
this class method gets passed the name of a model class that represents a table, and it lets the master model class do any set-up that's required. like a mom adopting a whole table, metaphorically. π
check_params
checks parameters against the DFV profile for the class, and returns the results of DFV's check. here's how you'd call it:
my $dfv_results = __PACKAGE__->check_params($r->params);
validation queen π
π Action Methods π
okay so action methods are methods that you access through the web (or any other public) interface. they're the ones with main character energy, the ones the people actually see. β
these are inherited from Maypole::Model::CDBI::Base β except do_edit, which is down below, she's special. π
do_edit
if there's an object in $r->objects, then it should be edited using the parameters in $r->params. otherwise, a brand new object gets created with those parameters, and gets put back into $r->objects. the template should be changed to view, or to edit if there were any errors. and a hash of errors gets passed to the template so everyone knows what went down. π
do_delete
inherited from Maypole::Model::CDBI::Base.
this action deletes records. dramatic. final. iconic. π
do_search
inherited from Maypole::Model::CDBI::Base.
this action method searches for database records. detective mode activated π
list
inherited from Maypole::Model::CDBI::Base.
the list method fills $r->objects with all of the objects in the class. the results are paged using a pager, because we are not rendering ten thousand rows at once, bestie, we have standards. β¨
π SEE ALSO π
Maypole::Model::BaseMaypole::Model::CDBI::Base
go read those too, iykyk π«Ά
π AUTHOR π
Aaron Trevena. π
β LICENSE β
you may distribute this code under the same terms as Perl itself. free to share, free to love, fr fr. πΈ
and that's the whole page bestie!! this was rendered byperl v5.42.0and dated2025-07-25β go forth and Maypole responsibly. mwah π π¦
π¦ where this page comes from
- fedora 43: perl-Maypole 1:2.13-46.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms