prepared for release of 5.65
Marcus Ramberg [Tue, 21 Feb 2006 09:36:36 +0000 (09:36 +0000)]
Changes
lib/Catalyst.pm
lib/Catalyst/Dispatcher.pm
t/lib/TestApp/Controller/Args.pm [new file with mode: 0644]
t/live_component_controller_action_local.t
t/live_component_controller_args.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index 477655a..331d23a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,10 @@
 This file documents the revision history for Perl extension Catalyst.
 
-       - Support optional hashref as last param for parameters in uri_for.
-    - Updated tutorial to be more complete.
+5.65    2006-02-21 10:34:00
+        - Added plugin introspection.
+        - Support optional hashref as last param for parameters in uri_for.
+        - Updated tutorial to be more complete.
+        - Applied args patch from antirice (Fixes Ticket #67)
 
 5.64    2006-02-07 20:29:00
         - Fixed bug in FastCGI proc manager mode where pm_post_dispatch
index a0c4d40..566eae0 100644 (file)
@@ -58,7 +58,7 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI');
 __PACKAGE__->request_class('Catalyst::Request');
 __PACKAGE__->response_class('Catalyst::Response');
 
-our $VERSION = '5.64';
+our $VERSION = '5.65';
 
 sub import {
     my ( $class, @arguments ) = @_;
index 8c4a5d8..05101b9 100644 (file)
@@ -196,6 +196,7 @@ sub prepare_action {
         # If not, move the last part path to args
         unshift @args, pop @path;
     }
+    s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg for @args;
 
     $c->log->debug( 'Path is "' . $c->req->match . '"' )
       if ( $c->debug && $c->req->match );
diff --git a/t/lib/TestApp/Controller/Args.pm b/t/lib/TestApp/Controller/Args.pm
new file mode 100644 (file)
index 0000000..6a448cd
--- /dev/null
@@ -0,0 +1,17 @@
+package TestApp::Controller::Args;
+
+use strict;
+use base 'Catalyst::Base';
+use Data::Dumper;
+
+sub args :Local  {
+    my ( $self, $c ) = @_;
+    $c->res->body( join('',@{$c->req->args}) );
+}
+
+sub params :Local {
+    my ( $self, $c ) = splice @_, 0, 2;
+    $c->res->body( join('',@_) );
+}
+
+1;
\ No newline at end of file
index 70a31e7..62c2674 100644 (file)
@@ -120,7 +120,7 @@ sub run_tests {
         );
         like(
             $response->content,
-            qr/arguments => \[\s*'foo%2Fbar'\s*\]/,
+            qr~arguments => \[\s*'foo/bar'\s*\]~,
             "Parameters don't split on %2F"
         );
     }
diff --git a/t/live_component_controller_args.t b/t/live_component_controller_args.t
new file mode 100644 (file)
index 0000000..9bdd7d9
--- /dev/null
@@ -0,0 +1,78 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use URI::Escape;
+
+our @paths;
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2;
+
+       # add special paths to test here
+       @paths = (
+                   # all reserved in uri's
+                   qw~ : / ? [ ] @ ! $ & ' ( ) * + ; = ~, ',' , '#',
+
+                   # unreserved
+                   'a'..'z','A'..'Z',0..9,qw( - . _ ~ ),
+                   " ",
+
+                   # just to test %2F/%
+                   [ qw~ / / ~ ],
+
+                   # testing %25/%25
+                   [ qw~ % % ~ ],
+                );
+}
+
+use Test::More tests => 4*@paths * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+    require Benchmark;
+    Benchmark::timethis( $iters, \&run_tests );
+
+    # new dispatcher:
+    # 11 wallclock secs (10.14 usr +  0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
+    # old dispatcher (r1486):
+    # 11 wallclock secs (10.34 usr +  0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
+}
+else {
+    for ( 1 .. $iters ) {
+        run_tests();
+    }
+}
+
+sub run_tests {
+    run_test_for($_) for @paths;
+}
+
+sub run_test_for {
+    my $test = shift;
+
+    my $path;
+    if (ref $test) {
+        $path = join "/", map uri_escape($_), @$test;
+        $test = join '', @$test;
+    } else {
+        $path = uri_escape($test);
+    }
+
+    my $response;
+
+    ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path");
+
+    is( $response->content, $test, 'as args' );
+
+    undef $response;
+
+    ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path");
+
+    is( $response->content, $test, 'as params' );
+}
+