[Bps-public-commit] Path-Dispatcher branch, master, updated. be912723f574439a77d53e810a8aed13076de449

Shawn Moore sartak at bestpractical.com
Sun Oct 17 05:11:52 EDT 2010


The branch, master has been updated
       via  be912723f574439a77d53e810a8aed13076de449 (commit)
      from  6aa991ac1218b2dda6dde0bb1ab610eafa5f98fb (commit)

Summary of changes:
 lib/Path/Dispatcher/Rule/Regex.pm |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit be912723f574439a77d53e810a8aed13076de449
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun Oct 17 18:11:33 2010 +0900

    Factor out the named_captures eval, much faster this way

diff --git a/lib/Path/Dispatcher/Rule/Regex.pm b/lib/Path/Dispatcher/Rule/Regex.pm
index 11945b1..523de3e 100644
--- a/lib/Path/Dispatcher/Rule/Regex.pm
+++ b/lib/Path/Dispatcher/Rule/Regex.pm
@@ -8,13 +8,15 @@ has regex => (
     required => 1,
 );
 
+my $named_captures = $] > 5.010 ? eval 'sub { %+ }' : sub { };
+
 sub _match {
     my $self = shift;
     my $path = shift;
 
     return unless my @positional = $path->path =~ $self->regex;
 
-    my %named = $] > 5.010 ? eval q{%+} : ();
+    my %named = $named_captures->();
 
     return {
         positional_captures => \@positional,

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list