[Bps-public-commit] path-dispatcher-declarative branch, master, updated. 310b766369f038ed5d866c2dc0414d5cf9ca5d55
Shawn Moore
sartak at bestpractical.com
Sun Oct 17 04:37:03 EDT 2010
The branch, master has been updated
via 310b766369f038ed5d866c2dc0414d5cf9ca5d55 (commit)
via e62c6672d07340b9b0019264fd0a481964cd7251 (commit)
from 7354308876d1e31000b34a52a353a3faaf013906 (commit)
Summary of changes:
lib/Path/Dispatcher/Declarative/Builder.pm | 29 +++++++++++++--------------
1 files changed, 14 insertions(+), 15 deletions(-)
- Log -----------------------------------------------------------------
commit e62c6672d07340b9b0019264fd0a481964cd7251
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Sun Oct 17 17:36:19 2010 +0900
Use %args instead of $block ? (block => $block) : (),
diff --git a/lib/Path/Dispatcher/Declarative/Builder.pm b/lib/Path/Dispatcher/Declarative/Builder.pm
index e737ea7..b6f919f 100644
--- a/lib/Path/Dispatcher/Declarative/Builder.pm
+++ b/lib/Path/Dispatcher/Declarative/Builder.pm
@@ -142,17 +142,17 @@ sub redispatch_to {
sub rule_creators {
return {
ARRAY => sub {
- my ($self, $tokens, $block) = @_;
+ my ($self, $tokens, %args) = @_;
Path::Dispatcher::Rule::Tokens->new(
tokens => $tokens,
delimiter => $self->token_delimiter,
case_sensitive => $self->case_sensitive_tokens,
- $block ? (block => $block) : (),
+ %args,
),
},
HASH => sub {
- my ($self, $metadata_matchers, $block) = @_;
+ my ($self, $metadata_matchers, %args) = @_;
if (keys %$metadata_matchers == 1) {
my ($field) = keys %$metadata_matchers;
@@ -162,37 +162,37 @@ sub rule_creators {
return Path::Dispatcher::Rule::Metadata->new(
field => $field,
matcher => $matcher,
- $block ? (block => $block) : (),
+ %args,
);
}
die "Doesn't support multiple metadata rules yet";
},
CODE => sub {
- my ($self, $matcher, $block) = @_;
+ my ($self, $matcher, %args) = @_;
Path::Dispatcher::Rule::CodeRef->new(
matcher => $matcher,
- $block ? (block => $block) : (),
+ %args,
),
},
Regexp => sub {
- my ($self, $regex, $block) = @_;
+ my ($self, $regex, %args) = @_;
Path::Dispatcher::Rule::Regex->new(
regex => $regex,
- $block ? (block => $block) : (),
+ %args,
),
},
empty => sub {
- my ($self, $undef, $block) = @_;
+ my ($self, $undef, %args) = @_;
Path::Dispatcher::Rule::Empty->new(
- $block ? (block => $block) : (),
+ %args,
),
},
};
}
sub _create_rule {
- my ($self, $matcher, $block) = @_;
+ my ($self, $matcher, %args) = @_;
my $rule_creator;
@@ -209,7 +209,7 @@ sub _create_rule {
$rule_creator or die "I don't know how to create a rule for type $matcher";
- return $rule_creator->($self, $matcher, $block);
+ return $rule_creator->($self, $matcher, %args);
}
sub _add_rule {
@@ -221,7 +221,7 @@ sub _add_rule {
}
else {
my ($matcher, $block) = splice @_, 0, 2;
- $rule = $self->_create_rule($matcher, $block);
+ $rule = $self->_create_rule($matcher, block => $block);
}
# FIXME: broken since move from ::Declarative
commit 310b766369f038ed5d866c2dc0414d5cf9ca5d55
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Sun Oct 17 17:36:49 2010 +0900
Pass prefix => 1 into the constructor instead of using the setter
diff --git a/lib/Path/Dispatcher/Declarative/Builder.pm b/lib/Path/Dispatcher/Declarative/Builder.pm
index b6f919f..a1d0de6 100644
--- a/lib/Path/Dispatcher/Declarative/Builder.pm
+++ b/lib/Path/Dispatcher/Declarative/Builder.pm
@@ -108,8 +108,7 @@ sub under {
my $self = shift;
my ($matcher, $rules) = @_;
- my $predicate = $self->_create_rule($matcher);
- $predicate->prefix(1);
+ my $predicate = $self->_create_rule($matcher, prefix => 1);
my $under = Path::Dispatcher::Rule::Under->new(
predicate => $predicate,
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list