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

sartak at bestpractical.com sartak at bestpractical.com
Fri Nov 14 13:04:17 EST 2008


Author: sartak
Date: Fri Nov 14 13:04:15 2008
New Revision: 16832

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

Log:
 r75489 at onn:  sartak | 2008-11-14 12:59:29 -0500
 Add an Always rule


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	Fri Nov 14 13:04:15 2008
@@ -60,11 +60,12 @@
 no Moose;
 
 # don't require others to load our subclasses explicitly
+require Path::Dispatcher::Rule::Always;
 require Path::Dispatcher::Rule::CodeRef;
+require Path::Dispatcher::Rule::Dispatch;
 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/Always.pm
==============================================================================
--- (empty file)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Always.pm	Fri Nov 14 13:04:15 2008
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+package Path::Dispatcher::Rule::Always;
+use Moose;
+extends 'Path::Dispatcher::Rule';
+
+sub _match {
+    my $self = shift;
+    my $path = shift;
+    return (1, $path);
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Path::Dispatcher::Rule::Always - always matches
+
+=head1 DESCRIPTION
+
+Rules of this class always match. If a prefix match is requested, the full path
+is returned as leftover.
+
+=cut
+
+



More information about the Bps-public-commit mailing list