[Bps-public-commit] r16781 - in Prophet/trunk: . lib/Prophet/Server
sartak at bestpractical.com
sartak at bestpractical.com
Sun Nov 9 11:43:31 EST 2008
Author: sartak
Date: Sun Nov 9 11:43:30 2008
New Revision: 16781
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/Server.pm
Prophet/trunk/lib/Prophet/Server/Dispatcher.pm
Log:
r75345 at onn: sartak | 2008-11-09 11:43:07 -0500
Path the declarative dispatcher class instance to its run method; this is $self
Modified: Prophet/trunk/lib/Prophet/Server.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server.pm (original)
+++ Prophet/trunk/lib/Prophet/Server.pm Sun Nov 9 11:43:30 2008
@@ -52,7 +52,7 @@
$self->cgi($cgi);
my $d = Prophet::Server::Dispatcher->new( server => $self );
- $d->run( $cgi->request_method . "/" . $cgi->path_info, $self )
+ $d->run( $cgi->request_method . "/" . $cgi->path_info, $d )
|| $self->_send_404;
};
Modified: Prophet/trunk/lib/Prophet/Server/Dispatcher.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server/Dispatcher.pm (original)
+++ Prophet/trunk/lib/Prophet/Server/Dispatcher.pm Sun Nov 9 11:43:30 2008
@@ -7,31 +7,28 @@
sub token_delimiter {'/'}
sub case_sensitive_tokens {0}
-my $SERVER;
-
-on qr'.*' => sub { $SERVER = shift; next_rule; };
-
under 'POST' => sub {
on qr'.*' => sub {
- return $SERVER->_send_401 if ( $SERVER->read_only );
+ my $self = shift;
+ return $self->server->_send_401 if ( $self->server->read_only );
next_rule;
};
under 'records' => sub {
- on qr|(.*)/(.*)/(.*)| => sub { $SERVER->update_record_prop() };
- on qr|(.*)/(.*).json| => sub { $SERVER->update_record() };
- on qr|^(.*).json| => sub { $SERVER->create_record() };
+ on qr|(.*)/(.*)/(.*)| => sub { shift->server->update_record_prop() };
+ on qr|(.*)/(.*).json| => sub { shift->server->update_record() };
+ on qr|^(.*).json| => sub { shift->server->create_record() };
};
};
under 'GET' => sub {
- on qr'replica/+(.*)$' => sub { $SERVER->serve_replica() };
- on 'records.json' => sub { $SERVER->get_record_types };
+ on qr'replica/+(.*)$' => sub { shift->server->serve_replica() };
+ on 'records.json' => sub { shift->server->get_record_types };
under 'records' => sub {
- on qr|(.*)/(.*)/(.*)| => sub { $SERVER->get_record_prop() };
- on qr|(.*)/(.*).json| => sub { $SERVER->get_record() };
- on qr|(.*).json| => sub { $SERVER->get_record_list() };
- on '^(.*)$' => sub { $SERVER->show_template() };
+ on qr|(.*)/(.*)/(.*)| => sub { shift->server->get_record_prop() };
+ on qr|(.*)/(.*).json| => sub { shift->server->get_record() };
+ on qr|(.*).json| => sub { shift->server->get_record_list() };
+ on '^(.*)$' => sub { shift->server->show_template() };
};
};
More information about the Bps-public-commit
mailing list