[Catalyst-commits] r13219 - Catalyst-Runtime/5.80/trunk/lib

wreis at dev.catalyst.perl.org wreis at dev.catalyst.perl.org
Thu May 6 12:34:10 GMT 2010


Author: wreis
Date: 2010-05-06 13:34:10 +0100 (Thu, 06 May 2010)
New Revision: 13219

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
make uri_for a bit cleaner

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2010-05-05 11:38:44 UTC (rev 13218)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2010-05-06 12:34:10 UTC (rev 13219)
@@ -1280,13 +1280,11 @@
     carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
     foreach my $arg (@args) {
         utf8::encode($arg) if utf8::is_utf8($arg);
+        $arg =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go;
     }
-    s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
-    if (blessed $path) { # Action object only.
-        s|/|%2F|g for @args;
-    }
 
     if ( blessed($path) ) { # action object
+        s|/|%2F|g for @args;
         my $captures = [ map { s|/|%2F|g; $_; }
                         ( scalar @args && ref $args[0] eq 'ARRAY'
                          ? @{ shift(@args) }
@@ -1307,8 +1305,6 @@
         $path = '/' if $path eq '';
     }
 
-    undef($path) if (defined $path && $path eq '');
-
     unshift(@args, $path);
 
     unless (defined $path && $path =~ s!^/!!) { # in-place strip




More information about the Catalyst-commits mailing list