added match_true and match_false
Christian Walde [Wed, 25 Jan 2012 16:19:19 +0000 (17:19 +0100)]
lib/Web/Dispatch/Parser.pm
lib/Web/Dispatch/Predicates.pm

index 1ccb650..08ad342 100644 (file)
@@ -35,7 +35,7 @@ sub parse {
 
 sub _parse_spec {
   my ($self, $spec, $nested) = @_;
-  return sub { {} } unless length($spec);
+  return match_true() unless length($spec);
   for ($_[1]) {
     my @match;
     PARSE: { do {
index 4ff3a93..6a489a5 100644 (file)
@@ -5,11 +5,19 @@ use base qw(Exporter);
 
 our @EXPORT = qw(
   match_and match_or match_not match_method match_path match_path_strip
-  match_extension match_query match_body match_uploads
+  match_extension match_query match_body match_uploads match_true match_false
 );
 
 sub _matcher { bless shift, 'Web::Dispatch::Matcher' }
 
+sub match_true {
+  _matcher(sub { {} });
+}
+
+sub match_false {
+  _matcher(sub {});
+}
+
 sub match_and {
   my @match = @_;
   _matcher(sub {