[Bps-public-commit] Path-Dispatcher branch, master, updated. 7f199668c19c461accaf188292562d682615adba
Shawn Moore
sartak at bestpractical.com
Tue Nov 2 08:12:01 EDT 2010
The branch, master has been updated
via 7f199668c19c461accaf188292562d682615adba (commit)
via 6778221228c19725841b2e0b6ae7d4015203c10f (commit)
via 6c76395cab8972fbc8f3810b323d84d63b16b954 (commit)
via df57888e8308d04222f4527565cb5fec1dbb61d3 (commit)
via fd2f5d7b139adcb1089f67e0a711ccb1f556f8be (commit)
from 4680cd14a8543594cb2e2a82b9aaed9cf495d0da (commit)
Summary of changes:
Changes | 3 +++
lib/Path/Dispatcher.pm | 2 +-
lib/Path/Dispatcher/Rule/Regex.pm | 10 +++++++++-
lib/Path/Dispatcher/Rule/Sequence.pm | 2 +-
lib/Path/Dispatcher/Rule/Under.pm | 5 ++++-
5 files changed, 18 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit fd2f5d7b139adcb1089f67e0a711ccb1f556f8be
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Nov 2 07:53:31 2010 -0400
We accidentally untokenized twice
diff --git a/lib/Path/Dispatcher/Rule/Sequence.pm b/lib/Path/Dispatcher/Rule/Sequence.pm
index 1155f5c..24b7d8e 100644
--- a/lib/Path/Dispatcher/Rule/Sequence.pm
+++ b/lib/Path/Dispatcher/Rule/Sequence.pm
@@ -43,7 +43,7 @@ sub _match {
my $leftover = $self->untokenize(@$tokens);
return {
- leftover => $self->untokenize(@$tokens),
+ leftover => $leftover,
positional_captures => $matched,
};
}
commit df57888e8308d04222f4527565cb5fec1dbb61d3
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Nov 2 07:59:03 2010 -0400
only provide leftover if we need it.
$' is slow, and it may be undef
diff --git a/lib/Path/Dispatcher/Rule/Regex.pm b/lib/Path/Dispatcher/Rule/Regex.pm
index 523de3e..acaafd0 100644
--- a/lib/Path/Dispatcher/Rule/Regex.pm
+++ b/lib/Path/Dispatcher/Rule/Regex.pm
@@ -18,10 +18,18 @@ sub _match {
my %named = $named_captures->();
+ my %extra;
+
+ # only provide leftover if we need it. $' is slow, and it may be undef
+ if ($self->prefix) {
+ $extra{leftover} = eval q{$'};
+ delete $extra{leftover} if !defined($extra{leftover});
+ }
+
return {
positional_captures => \@positional,
named_captures => \%named,
- ($self->prefix ? (leftover => eval q{$'}) : ()),
+ %extra,
}
}
commit 6c76395cab8972fbc8f3810b323d84d63b16b954
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Nov 2 08:00:36 2010 -0400
Default leftover to ''
diff --git a/lib/Path/Dispatcher/Rule/Under.pm b/lib/Path/Dispatcher/Rule/Under.pm
index 908cdd0..1e757fb 100644
--- a/lib/Path/Dispatcher/Rule/Under.pm
+++ b/lib/Path/Dispatcher/Rule/Under.pm
@@ -22,7 +22,10 @@ sub match {
my $prefix_match = $self->predicate->match($path)
or return;
- my $new_path = $path->clone_path($prefix_match->leftover);
+ my $leftover = $prefix_match->leftover;
+ $leftover = '' if !defined($leftover);
+
+ my $new_path = $path->clone_path($leftover);
# Pop off @matches until we have a last rule that is not ::Chain
#
commit 6778221228c19725841b2e0b6ae7d4015203c10f
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Nov 2 08:02:17 2010 -0400
1.02 Changes
diff --git a/Changes b/Changes
index 922c32c..d62a716 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Revision history for Path-Dispatcher
+1.02 Tue Nov 2 2010
+ Various improvements to the handling of $match->leftover with undef
+
1.01 Sun Oct 24 2010
Skip t/026-named-captures.t if you don't have 5.10.1
commit 7f199668c19c461accaf188292562d682615adba
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Nov 2 08:02:35 2010 -0400
Bump to 1.02
diff --git a/lib/Path/Dispatcher.pm b/lib/Path/Dispatcher.pm
index 1d1139e..3f62cdb 100644
--- a/lib/Path/Dispatcher.pm
+++ b/lib/Path/Dispatcher.pm
@@ -2,7 +2,7 @@ package Path::Dispatcher;
use Any::Moose;
use 5.008001;
-our $VERSION = '1.01';
+our $VERSION = '1.02';
use Path::Dispatcher::Rule;
use Path::Dispatcher::Dispatch;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list