[Bps-public-commit] r16350 - in Path-Dispatcher/trunk: lib/Path/Dispatcher
sartak at bestpractical.com
sartak at bestpractical.com
Sun Oct 19 04:02:40 EDT 2008
Author: sartak
Date: Sun Oct 19 04:02:39 2008
New Revision: 16350
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm
Log:
r74061 at onn: sartak | 2008-10-19 04:02:33 -0400
Begin implementation of prefix matching
Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm (original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm Sun Oct 19 04:02:39 2008
@@ -10,13 +10,24 @@
required => 1,
);
+has prefix => (
+ is => 'ro',
+ isa => 'Bool',
+ default => 0,
+);
+
sub match {
my $self = shift;
my $path = shift;
- my $result = $self->_match($path);
+ my ($result, $leftover) = $self->_match($path);
return unless $result;
+ # if we're not matching only a prefix then require the leftover to be empty
+ return if defined($leftover)
+ && length($leftover)
+ && !$self->prefix;
+
# make sure that the returned values are PLAIN STRINGS
# later we will stick them into a regular expression to populate $1 etc
# which will blow up later!
More information about the Bps-public-commit
mailing list