summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-02-17 21:43:43 -0600
committerJesse Luehrs <doy@tozt.net>2011-02-17 21:43:43 -0600
commit58a447a99980b9921d498444a72f1705823a049e (patch)
treef7322c86331fa31ef5ebd465e6b56546a2932b67
parenta0c5a7ce958bf1f619b95f7b5235b1fddd43e961 (diff)
downloadnarwhal-58a447a99980b9921d498444a72f1705823a049e.tar.gz
narwhal-58a447a99980b9921d498444a72f1705823a049e.zip
actually, make this a bit more explicit
-rw-r--r--lib/Narwhal.pm2
-rw-r--r--lib/Narwhal/RouteBuilder/HTTPMethod.pm5
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/Narwhal.pm b/lib/Narwhal.pm
index aae8a25..4437027 100644
--- a/lib/Narwhal.pm
+++ b/lib/Narwhal.pm
@@ -39,7 +39,7 @@ router as {
route '/page/:page_name' => 'wiki.page', (
page_name => { isa => 'Str' },
);
- route '/edit/:page_name' => 'edit', (
+ route '/edit/:page_name' => 'http-method:edit', (
page_name => { isa => 'Str' },
);
}, (
diff --git a/lib/Narwhal/RouteBuilder/HTTPMethod.pm b/lib/Narwhal/RouteBuilder/HTTPMethod.pm
index fb2f124..9631616 100644
--- a/lib/Narwhal/RouteBuilder/HTTPMethod.pm
+++ b/lib/Narwhal/RouteBuilder/HTTPMethod.pm
@@ -9,9 +9,10 @@ sub import {
class => __PACKAGE__,
route_spec => sub {
my $spec = shift;
- return if ref($spec) || $spec !~ /^\w+$/;
+ return if ref($spec);
+ return unless $spec =~ /^http-method:(\w+)$/;
return {
- action => $spec,
+ action => $1,
};
},
);