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

sartak at bestpractical.com sartak at bestpractical.com
Fri Mar 6 22:41:11 EST 2009


The branch, master has been updated
       via  14b2e4449b86cbb2519336832b0e6b42e3c13d04 (commit)
      from  f9a835332952f251553f827a07b55643caa65003 (commit)

Summary of changes:
 lib/Path/Dispatcher/Declarative.pm |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 14b2e4449b86cbb2519336832b0e6b42e3c13d04
Author: Shawn M Moore <sartak at gmail.com>
Date:   Fri Mar 6 22:41:03 2009 -0500

    Factor out populating defaults

diff --git a/lib/Path/Dispatcher/Declarative.pm b/lib/Path/Dispatcher/Declarative.pm
index 4131bff..ee7564c 100644
--- a/lib/Path/Dispatcher/Declarative.pm
+++ b/lib/Path/Dispatcher/Declarative.pm
@@ -24,7 +24,7 @@ sub import {
     my $self = shift;
     my $pkg  = caller;
 
-    my @args = grep { !/^-[bB]ase$/ } @_;
+    my @args = grep { !/^-base$/i } @_;
 
     # just loading the class..
     return if @args == @_;
@@ -44,14 +44,7 @@ sub build_sugar {
 
     my $into = $CALLER;
 
-    for my $option ('token_delimiter', 'case_sensitive_tokens') {
-        next if exists $arg->{$option};
-
-        my $default = $class->$option;
-        next unless defined $default; # use the builder's default
-
-        $arg->{$option} = $class->$option;
-    }
+    $class->populate_defaults($arg);
 
     my $dispatcher = $class->dispatcher_class->new(name => $into);
 
@@ -80,6 +73,21 @@ sub build_sugar {
     };
 }
 
+sub populate_defaults {
+    my $class = shift;
+    my $arg  = shift;
+
+    for my $option ('token_delimiter', 'case_sensitive_tokens') {
+        next if exists $arg->{$option};
+
+        my $default = $class->$option;
+        next unless defined $default; # use the builder's default
+
+        $arg->{$option} = $class->$option;
+    }
+}
+
+
 1;
 
 __END__

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



More information about the Bps-public-commit mailing list