summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}
);
}