New patches: [unrevert anonymous**20050820162656] < > { hunk ./lib/Data/FormValidator/Results.pm 994 no strict "refs"; my $re = &$re_name(-keep=>1,@params) || die 'no matching Regexp::Common routine found'; return ($self->get_current_constraint_value =~ qr/^$re$/) ? $1 : undef; +v v v v v v v +} + +# _add_constraints_from_map($profile,'constraint',\%valid); +# Returns: +# - a hash to add to either 'constraints' or 'constraint_methods' + +sub _add_constraints_from_map { + die "_add_constraints_from_map: need 3 arguments" unless (scalar @_ == 3); + my ($profile, $name, $valid) = @_; + ($name =~ m/^constraint(_method)?$/) || die "unexpected input."; + + my $key_name = $name.'s'; + my $map_name = $name.'_regexp_map'; + + my %result = (); + foreach my $re (keys %{ $profile->{$map_name} }) { + my $sub = _create_sub_from_RE($re); + + # find all the keys that match this RE and add a constraint for them + for my $key (keys %$valid) { + if ($sub->($key)) { + my $cur = $profile->{$key_name}{$key}; + my $new = $profile->{$map_name}{$re}; + # If they already have an arrayref of constraints, add to the list + if (ref $cur eq 'ARRAY') { + push @{ $result{$key} }, $new; + } + # If they have a single constraint defined, create an array ref with with this plus the new one + elsif ($cur) { + $result{$key} = [$cur,$new]; + } + # otherwise, a new constraint is created with this as the single constraint + else { + $result{$key} = $new; + } + warn "constraint_regexp_map: $key matches\n" if $profile->{debug}; + } + } + } + return %result; +************* +} + +sub _bool_overload_based_on_success { + my $results = shift; + return $results->success() +^ ^ ^ ^ ^ ^ ^ } # _add_constraints_from_map($profile,'constraint',\%valid); } Context: [version bump to 4.01 Mark Stosberg **20050820025055] [params not mentioned patch from Michael Peters, with minor adjustments Mark Stosberg **20050820025002] [Final Changes update for 4.00 release Mark Stosberg **20050814160513] [version bumps for 4.00 release Mark Stosberg **20050814155548] [Mention ::Constraints::DateTime, and other minor code cleanups Mark Stosberg **20050814155329] [improve formatting Mark Stosberg **20050814013829] [mention ::Filters::Image Mark Stosberg **20050813164523] [support for coderefs as default values (Marcello) Mark Stosberg **20050813163717] [Changes file updates Mark Stosberg **20050813155521] [merging changes from stable branch Mark Stosberg **20050813144902] [adjust test to cooperate with overload Mark Stosberg **20050813144838] [fix test to work with regressed $invalids return value Mark Stosberg **20050813143544] [Regression fix: Return no invalids as empty arrayref through validate() Mark Stosberg **20050731172105 ...because some old code depended on that undocumented return value. ] [The Results object is evaluated by success in boolean context. Mark Stosberg **20050720015057] [file move Mark Stosberg **20050720010656] [RT#14046 - clarify filter docs Mark Stosberg **20050808163909] [Changelog entry: Add many failing TODO tests for built-in filters. See t/filters_builtin.t Mark Stosberg **20050731161249] [Adding more tests built-in filters, mostly are failing TODO tests Mark Stosberg **20050731161112] [clarify docs for required_regexp Mark Stosberg **20050728190614] [new test for filter_dollars() Mark Stosberg **20050722013855] [typo fix in docs Mark Stosberg **20050722013502] [mention public darcs repo location Mark Stosberg **20050718024424] [remove a hardcoded field name... David Emery **20050707081535 Fixed a dumb error that had the fieldname for the uploaded file in place of $field. ] [administriva for CGI::Simple updates: Changes mention and version bump Mark Stosberg **20050705125203] [allow use with CGI::Simple dave@skiddlydee.com**20050705050636 If the passed in obj is CGI::Simple rather than CGI, the $q->tmpFileName() method will not be available. Instead Simple provides a filehandle which we can use to get the file info from, using File::MMagic. Initially I had tried to use $q->can("tmpFileName") to check if the method was available, but it turns out that that will always return undef. So instead I've used $q->isa("CGI::Simple") and then fetch the filehandle if that's true, otherwise assuming, as before, that it's a CGI object. ] [Improved field_filters documentation, thanks to Andrew Brosnan. Mark Stosberg **20050703200107] [TAG 4.00_02 Mark Stosberg **20050703193433] Patch bundle hash: e54e152327f738b95d1df9f79225872b98bb2f43