adapted to take dashes
[catagits/Web-Simple.git] / lib / Web / Dispatch / Parser.pm
index 422182c..b7d604a 100644 (file)
@@ -144,7 +144,9 @@ sub _url_path_match {
       push @path, $self->_url_path_segment_match($_)
         or $self->_blam("Couldn't parse path match segment");
     }
-    !$end and length and $_ .= '(?:\.\w+)?' for $path[-1];
+    if (@path && !$end) {
+      length and $_ .= '(?:\.\w+)?' for $path[-1];
+    }
     my $re = '^('.join('/','',@path).')'.$end.'$';
     $re = qr/$re/;
     if ($end) {
@@ -163,14 +165,14 @@ sub _url_path_segment_match {
     /\G(?:(?=[+|\)])|$)/gc and
       return '';
     # word chars only -> exact path part match
-    /\G(\w+)/gc and
+    /\G([\w\-]+)/gc and
       return "\Q$1";
     # ** -> capture unlimited path parts
     /\G\*\*/gc and
       return '(.*?[^/])';
     # * -> capture path part
     /\G\*/gc and
-      return '([^/]+)';
+      return '([^/]+?)';
   }
   return ();
 }