[Jifty-commit] r459 -
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jan 5 11:22:44 EST 2006
Author: jesse
Date: Thu Jan 5 11:22:44 2006
New Revision: 459
Modified:
/ (props changed)
jifty/trunk/lib/Jifty/Dispatcher.pm
Log:
r22133 at truegrounds: jesse | 2006-01-05 17:21:06 +0100
* in -> under
* fix to a bogus dispatcher->{'op'} from audrey
Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm Thu Jan 5 11:22:44 2006
@@ -20,7 +20,7 @@
package MyApp::Dispatcher;
use Jifty::Dispatcher -base;
- in ['blog', 'wiki'] => [
+ under ['blog', 'wiki'] => [
run {
default model => "MyApp::Model::\u$1"
},
@@ -42,12 +42,12 @@
on '*' => run { dispatch "$1/view" },
on '' => show '/display/list',
];
- in qr{logs/(\d+)} => [
+ under qr{logs/(\d+)} => [
when { $1 > 100 } => show '/error',
default model => 'MyApp::Model::Log',
run { dispatch "/wiki/LogPage-$1" },
];
- # ... more rule rules ...
+ # ... more rules ...
=head1 DESCRIPTION
@@ -93,7 +93,7 @@
=head1 Things your dispatch routine might do
-=head2 in $match => $rule
+=head2 under $match => $rule
Match against the current requested path. If matched, set the current
context to the directory and process the rule, which may be an array
@@ -107,12 +107,12 @@
=head2 on $match => $rule
-Like C<in>, except it has to match the whole path instead of just the prefix.
+Like C<under>, except it has to match the whole path instead of just the prefix.
Does not set current directory context for its rules.
=head2 when {...} => $rule
-Like C<on>, except using an user-supplied test condition.
+Like C<undef>, except using an user-supplied test condition.
=head2 run {...}
@@ -157,7 +157,7 @@
=cut
our @EXPORT = qw<
- in on run when set del default
+ under on run when set del default
show dispatch abort redirect
@@ -171,7 +171,7 @@
our $Dispatcher;
sub ret (@);
-sub in ($$@) { ret @_ } # partial match at beginning of path component
+sub under ($$@) { ret @_ } # partial match at beginning of path component
sub on ($$@) { ret @_ } # exact match on the path component
sub when (&@) { ret @_ } # exact match on the path component
sub run (&@) { ret @_ } # execute a block of code
@@ -305,7 +305,7 @@
};
return unless $@;
- local $self->{op} = $op;
+ local $self->{rule} = $op;
my $meth = "do_$op";
$self->$meth(@args);
}
@@ -315,7 +315,7 @@
sub next_rule { next RULE }
sub last_rule { last HANDLER }
-sub do_in {
+sub do_under {
my ($self, $cond, $rules) = @_;
if ( my $regex = $self->match($cond) ) {
# match again to establish $1 $2 etc in the dynamic scope
@@ -387,6 +387,7 @@
sub do_set {
my ($self, $key, $value) = @_;
+
$self->{args}{$key} = $value;
}
@@ -480,7 +481,6 @@
# empty path -- just match $cwd itself
$cond = "(?<=\\A$self->{cwd})";
}
-
if ($Dispatcher->{rule} eq 'on') {
# "on" anchors on complete match only
$cond .= '\\z';
More information about the Jifty-commit
mailing list