X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FCDBI%2FFromCGI.pm;h=9baaf9efe916c3117a44b60ae7cc0ffb7781ccad;hb=1abc072646e8d37a20ee85c8ca6bb548e2176027;hp=8c28c2c7f114ecb3298fe1ec0d5807287fe91294;hpb=5c776a61a4b51aa2dc97c08fcb5feffd20f14063;p=maypole.git diff --git a/lib/Maypole/Model/CDBI/FromCGI.pm b/lib/Maypole/Model/CDBI/FromCGI.pm index 8c28c2c..9baaf9e 100644 --- a/lib/Maypole/Model/CDBI/FromCGI.pm +++ b/lib/Maypole/Model/CDBI/FromCGI.pm @@ -1,5 +1,6 @@ package Maypole::Model::CDBI::FromCGI; use strict; +use warnings; =head1 NAME @@ -29,7 +30,6 @@ on Class::DBI::FromCGI. =cut -use warnings; # The base base model class for apps # provides good search and create functions @@ -233,7 +233,6 @@ sub add_to_from_cgi { unless ref $self; my ($errors, $validated, @created); - my $params = $opts->{params} || $r->params; $opts->{params} = $self->classify_form_inputs($params); ($validated, $errors) = $self->validate_all($r, $opts); @@ -342,18 +341,22 @@ sub validate_all { } -# validate_inputs undocumented. It is not yet part of the public interface. -#=head2 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. -# -#=cut + +=head2 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. + +=cut sub validate_inputs { my ($self, $h, $opts) = @_; @@ -375,9 +378,7 @@ sub validate_inputs { # Required field error if ($required{$field} and !ref($value) and $err =~ /^No input for/) { - #($value eq '' or !defined $value)) $errors->{$field} = "You must supply '$field'" - #unless ($updating and$self->field; } elsif ($err) { # 1: No inupt entered