1Maypole::Model::CDBI::FUrsoemrCGCIo(n3t)ributed Perl DocMuamyepnotlaet:i:oMnodel::CDBI::FromCGI(3)
2
3
4

NAME

6       Maypole::Model:CDBI::FromCGI - Validate form input and populate Model
7       objects
8

SYNOPSIS

10         $obj = $class->create_from_cgi($r);
11         $obj = $class->create_from_cgi($r, { params => {data1=>...}, required => [..],
12                        ignore => [...], all => [...]);
13         $obj = $class->create_from_cgi($h, $options); # CDBI::FromCGI style, see docs
14
15         $obj->update_from_cgi($r);
16         $obj->update_from_cgi($h, $options);
17
18         $obj = $obj->add_to_from_cgi($r);
19         $obj = $obj->add_to_from_cgi($r, { params => {...} } );
20
21         # This does not work like in CDBI::FromCGI and probably never will :
22         # $class->update_from_cgi($h, @columns);
23

DESCRIPTION

25       Provides a way to validate form input and populate Model Objects, based
26       on Class::DBI::FromCGI.
27

METHODS

29   untaint_columns
30       Replicates Class::DBI::FromCGI method of same name :
31
32         __PACKAGE__->untaint_columns(
33           printable => [qw/Title Director/],
34           integer   => [qw/DomesticGross NumExplodingSheep],
35           date      => [qw/OpeningDate/],
36         );
37
38   untaint_type
39         gets the  untaint type for a column as set in "untaint_types"
40
41   cgi_update_errors
42       Returns errors that ocurred during an operation.
43
44   create_from_cgi
45       Based on the same method in Class::DBI::FromCGI.
46
47       Creates  multiple objects  from a  cgi form.  Errors are returned in
48       cgi_update_errors
49
50       It can be called Maypole style passing the Maypole request object as
51       the first arg, or Class::DBI::FromCGI style passing the Untaint Handler
52       ($h) as the first arg.
53
54       A hashref of options can be passed as the second argument. Unlike in
55       the CDBI equivalent, you can *not* pass a list as the second argument.
56       Options can be :
57        params -- hashref of cgi data to use instead of $r->params,
58        required -- list of fields that are required
59        ignore   -- list of fields to ignore
60        all      -- list of all fields (defaults to $class->columns)
61
62   update_from_cgi
63       Replicates the Class::DBI::FromCGI method of same name. It updates an
64       object and returns 1 upon success. It can take the same arguments as
65       create_form_cgi.  If errors, it sets the cgi_update_errors.
66
67   add_to_from_cgi
68       $obj->add_to_from_cgi($r[, $opts]);
69
70       Like add_to_* for has_many relationships but will add nay objects it
71       can figure out from the data.  It returns a list of objects it creates
72       or nothing on error. Call cgi_update_errors with the calling object to
73       get errors.  Fatal errors are in the respective "FATAL" key.
74
75   validate_all
76       Validates (untaints) a hash of possibly mixed table data.  Returns
77       validated and errors ($validated, $errors).  If no errors then undef in
78       that spot.
79
80   validate_inputs
81       $self->validate_inputs($h, $opts);
82
83       This is the main validation method to validate inputs for a single
84       class.  Most of the time you use validate_all.
85
86       Returns validated and errors.
87
88       If no errors then undef in that slot.
89
90       Note: This method is currently experimental (in 2.11) and may be
91       subject to change without notice.
92
93   classify_form_inputs
94       $self->classify_form_inputs($params[, $delimiter]);
95
96       Foreign inputs are inputs that have data for a related table.  They
97       come named so we can tell which related class they belong to.  This
98       assumes the form : $accessor . $delimeter . $column recursively
99       classifies them into hashes. It returns a hashref.
100

MAINTAINER

102       Maypole Developers
103

AUTHORS

105       Peter Speltz, Aaron Trevena
106

AUTHORS EMERITUS

108       Tony Bowden
109

TODO

111       * Tests * add_to_from_cgi, search_from_cgi * complete documentation *
112       ensure full backward compatibility with Class::DBI::FromCGI
113

BUGS and QUERIES

115       Please direct all correspondence regarding this module to:
116        Maypole list.
117
119       Copyright 2003-2004 by Peter Speltz
120
121       This library is free software; you can redistribute it and/or modify it
122       under the same terms as Perl itself.
123

SEE ALSO

125       Class::DBI, Class::DBI::FromCGI
126
127
128
129perl v5.36.0                      2022-07-22  Maypole::Model::CDBI::FromCGI(3)
Impressum