[Bps-public-commit] Prophet - A disconnected, replicated p2p database branch, master, updated. 4b6283f2bba09d2de675ea70d479ddf8b445ce25

sartak at bestpractical.com sartak at bestpractical.com
Tue Feb 10 14:59:56 EST 2009


The branch, master has been updated
       via  4b6283f2bba09d2de675ea70d479ddf8b445ce25 (commit)
      from  88b883d14c250b9081679f160fcf88ef88d49ea0 (commit)

Summary of changes:
 lib/Prophet/Server.pm            |    9 ++++++++-
 lib/Prophet/Server/Dispatcher.pm |    6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 4b6283f2bba09d2de675ea70d479ddf8b445ce25
Author: Shawn M Moore <sartak at gmail.com>
Date:   Tue Feb 10 14:59:44 2009 -0500

    Use the new metadata matching stuff for Prophet::Server::Dispatcher

diff --git a/lib/Prophet/Server.pm b/lib/Prophet/Server.pm
index e654a6f..e417334 100644
--- a/lib/Prophet/Server.pm
+++ b/lib/Prophet/Server.pm
@@ -159,7 +159,14 @@ sub handle_request {
 
     my $d = $dispatcher_class->new( server => $self );
 
-    $d->run( $cgi->request_method . $cgi->path_info, $d )
+    my $path = Path::Dispatcher::Path->new(
+        path => $cgi->path_info,
+        metadata => {
+            method => $cgi->request_method,
+        },
+    );
+
+    $d->run( $path, $d )
         || $self->_send_404;
 
 }
diff --git a/lib/Prophet/Server/Dispatcher.pm b/lib/Prophet/Server/Dispatcher.pm
index 9ebc8d1..2ebccea 100644
--- a/lib/Prophet/Server/Dispatcher.pm
+++ b/lib/Prophet/Server/Dispatcher.pm
@@ -7,7 +7,7 @@ has server => ( isa => 'Prophet::Server', is => 'rw', weak_ref => 1 );
 sub token_delimiter       {'/'}
 sub case_sensitive_tokens {0}
 
-under 'POST' => sub {
+under { method => 'POST' } => sub {
     on qr'.*' => sub {
         my $self = shift;
         return $self->server->_send_401 if ( $self->server->read_only );
@@ -21,7 +21,7 @@ under 'POST' => sub {
     };
 };
 
-under 'GET' => sub {
+under { method => 'GET' } => sub {
     on qr'^=/prophet/autocomplete' => sub {
         shift->server->show_template('/_prophet_autocompleter') };
     on qr'^static/prophet/(.*)$' => sub { shift->server->send_static_file($1)};
@@ -34,7 +34,7 @@ under 'GET' => sub {
     };
 };
 
-on qr'^(?:GET|POST|PUT|DELETE|PATCH)(/.*)$' => sub { shift->server->show_template($1) || next_rule; };
+on qr'^(/.*)$' => sub { shift->server->show_template($1) || next_rule; };
 
 no Any::Moose;
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list