summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2010-06-05 14:15:25 -0400
committerJason Woodward2010-06-05 14:15:25 -0400
commitd6f2dfa80146d1bb9a688375d4d147b78b070e80 (patch)
tree42208254d39fdb552aa8796f432624f9e0a65790
parent3e873c7c8ab4a1ab57fc864cdfbff59338ae5f05 (diff)
downloadJaos-WebApp-d6f2dfa80146d1bb9a688375d4d147b78b070e80.tar.gz
Updated ParamConstraint
It should only return true if all specified constraints match
-rw-r--r--lib/Jaos/WebApp/Route/ParamConstraint.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Jaos/WebApp/Route/ParamConstraint.pm b/lib/Jaos/WebApp/Route/ParamConstraint.pm
index c524833..a5b8cf7 100644
--- a/lib/Jaos/WebApp/Route/ParamConstraint.pm
+++ b/lib/Jaos/WebApp/Route/ParamConstraint.pm
@@ -17,13 +17,17 @@ sub register
if (my $value = $ctx->req->param($key)) {
$ctx->log->debug("Checking $key($value) against $pattern");
if (ref $pattern eq 'Regexp') {
- return $value =~ $pattern;
+ return if $value !~ $pattern;
} else {
- return $value eq $pattern;
+ return if $value ne $pattern;
}
+ } else {
+ # no required parameter
+ return;
}
}
- return;
+ # if we got this far, things must be good
+ return 1;
}
);
}