[Bps-public-commit] r16418 - in Path-Dispatcher/trunk: lib/Path/Dispatcher lib/Path/Dispatcher/Rule

sartak at bestpractical.com sartak at bestpractical.com
Tue Oct 21 10:34:38 EDT 2008


Author: sartak
Date: Tue Oct 21 10:34:38 2008
New Revision: 16418

Added:
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm
Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm

Log:
 r74254 at onn:  sartak | 2008-10-21 10:34:32 -0400
 Path::Dispatcher::Rule::Dispatch which is a much saner and more flexible "super dispatcher"


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	Tue Oct 21 10:34:38 2008
@@ -70,6 +70,7 @@
 require Path::Dispatcher::Rule::Regex;
 require Path::Dispatcher::Rule::Tokens;
 require Path::Dispatcher::Rule::Under;
+require Path::Dispatcher::Rule::Dispatch;
 
 1;
 

Added: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Dispatch.pm	Tue Oct 21 10:34:38 2008
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+package Path::Dispatcher::Rule::Dispatch;
+use Moose;
+extends 'Path::Dispatcher::Rule';
+
+has dispatcher => (
+    is       => 'rw',
+    isa      => 'Path::Dispatcher',
+    required => 1,
+);
+
+sub _match {
+    my $self = shift;
+    my $path = shift;
+
+    my $dispatch = $self->dispatcher->dispatch($path);
+    return $dispatch->matches;
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+no Moose::Util::TypeConstraints;
+
+1;
+



More information about the Bps-public-commit mailing list