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

MAINTAINER

111       Maypole Developers
112

AUTHORS

114       Peter Speltz, Aaron Trevena
115

AUTHORS EMERITUS

117       Tony Bowden
118

TODO

120       * Tests * add_to_from_cgi, search_from_cgi * complete documentation *
121       ensure full backward compatibility with Class::DBI::FromCGI
122

BUGS and QUERIES

124       Please direct all correspondence regarding this module to:
125        Maypole list.
126
128       Copyright 2003-2004 by Peter Speltz
129
130       This library is free software; you can redistribute it and/or modify it
131       under the same terms as Perl itself.
132

SEE ALSO

134       Class::DBI, Class::DBI::FromCGI
135
136
137
138perl v5.8.8                       2005-11-23  Maypole::Model::CDBI::FromCGI(3)
Impressum