Maypole...:FromCGI(3)
πΈ Maypole...:FromCGI(3) πΈ
okay bestie, this page lives in the User Contributed Perl Documentation manual, and it's all about Maypole::Model:CDBI::FromCGI π β the module that validates your form input and then populates your Model objects for you. it's giving "I'll handle the boring part, you go be the main character" β¨
β¨ NAME β¨
Maypole::Model:CDBI::FromCGI β Validate form input and populate Model objects π
π¦ SYNOPSIS π¦
$obj = $class->create_from_cgi($r);
$obj = $class->create_from_cgi($r, { params => {data1=>...}, required => [..],
ignore => [...], all => [...]);
$obj = $class->create_from_cgi($h, $options); # CDBI::FromCGI style, see docs
$obj->update_from_cgi($r);
$obj->update_from_cgi($h, $options);
$obj = $obj->add_to_from_cgi($r);
$obj = $obj->add_to_from_cgi($r, { params => {...} } );
# This does not work like in CDBI::FromCGI and probably never will :
# $class->update_from_cgi($h, @columns);
π DESCRIPTION π
so the whole vibe here is: it gives you a way to validate form input and populate Model Objects, based on Class::DBI::FromCGI. that's the tea β no cap.
π METHODS π
π untaint_columns π
Replicates the Class::DBI::FromCGI method of the same name, fr fr:
__PACKAGE__->untaint_columns(
printable => [qw/Title Director/],
integer => [qw/DomesticGross NumExplodingSheep],
date => [qw/OpeningDate/],
);
πΈ untaint_type πΈ
gets the untaint type for a column as set in "untaint_types" π
β cgi_update_errors β
Returns errors that ocurred during an operation. (yes, "ocurred", we keep it exactly as it is bestie π) it's your receipts folder for what went wrong.
π¦ create_from_cgi π¦
Based on the same method in Class::DBI::FromCGI.
Creates multiple objects from a cgi form. Errors are returned in cgi_update_errors π
It can be called Maypole style β passing the Maypole request object as the first arg β or Class::DBI::FromCGI style, passing the Untaint Handler ($h) as the first arg.
A hashref of options can be passed as the second argument. Unlike in the CDBI equivalent, you can not pass a list as the second argument. π¨ Options can be:
paramsβ hashref of cgi data to use instead of$r->paramsrequiredβ list of fields that are requiredignoreβ list of fields to ignoreallβ list of all fields (defaults to$class->columns)
π update_from_cgi π
Replicates the Class::DBI::FromCGI method of the same name. It updates an object and returns 1 upon success β¨ It can take the same arguments as create_form_cgi. If errors, it sets the cgi_update_errors.
π add_to_from_cgi π
$obj->add_to_from_cgi($r[, $opts]);
Like add_to_* for has_many relationships, but will add nay objects it can figure out from the data π It returns a list of objects it creates, or nothing on error. Call cgi_update_errors with the calling object to get errors. Fatal errors are in the respective "FATAL" key π
π§ validate_all π§
Validates (untaints) a hash of possibly mixed table data. Returns validated and errors ($validated, $errors). If no errors then undef in that spot.
π₯ validate_inputs π₯
$self->validate_inputs($h, $opts);
This is the main validation method to validate inputs for a single class. Most of the time you use validate_all.
Returns validated and errors.
If no errors then undef in that slot.
β οΈ Note: This method is currently experimental (in 2.11) and may be subject to change without notice. lowkey do not build your whole personality on it, it might shift π
π classify_form_inputs π
$self->classify_form_inputs($params[, $delimiter]);
Foreign inputs are inputs that have data for a related table. They come named so we can tell which related class they belong to π΅οΈβοΈ This assumes the form: $accessor . $delimeter . $column, and recursively classifies them into hashes. It returns a hashref.
π«Ά MAINTAINER π«Ά
Maypole Developers π
β¨ AUTHORS β¨
Peter Speltz, Aaron Trevena π
π AUTHORS EMERITUS π
Tony Bowden π
π TODO π
- Tests
add_to_from_cgi,search_from_cgi- complete documentation
- ensure full backward compatibility with
Class::DBI::FromCGI
π BUGS and QUERIES π
Please direct all correspondence regarding this module to: Maypole list. π¬
π COPYRIGHT AND LICENSE π
Copyright 2003-2004 by Peter Speltz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π©·
π SEE ALSO π
Class::DBIClass::DBI::FromCGI
and that's the whole page bestie, you ate that π
this was Maypole...:FromCGI(3), generated from perl v5.42.0 on 2025-07-25, and you're officially a Unix girlie now. periodt. π¦β¨
π¦ 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