[Catalyst-commits] r13212 - in
Catalyst-Plugin-Unicode-Encoding/branches: . decode_captures
decode_captures/lib/Catalyst/Plugin/Unicode decode_captures/t
decode_captures/t/lib/TestApp/Controller
wreis at dev.catalyst.perl.org
wreis at dev.catalyst.perl.org
Tue May 4 18:52:41 GMT 2010
Author: wreis
Date: 2010-05-04 19:52:41 +0100 (Tue, 04 May 2010)
New Revision: 13212
Added:
Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/
Modified:
Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/Changes
Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/lib/Catalyst/Plugin/Unicode/Encoding.pm
Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/t/06request_decode.t
Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/t/lib/TestApp/Controller/Root.pm
Log:
decode request's captures
Modified: Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/Changes
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/Changes 2010-03-07 22:49:01 UTC (rev 13023)
+++ Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/Changes 2010-05-04 18:52:41 UTC (rev 13212)
@@ -1,5 +1,9 @@
Revision history for Perl extension Catalyst::Plugin::Unicode::Encoding
+0.10
+ - Correctly decode UTF-8 URI Encoded (as per RFC3986) into
+ $c->request->captures (wreis)
+
0.9 2010-03-07 22:50:00
- Correctly decode UTF-8 URI Encoded (as per RFC3986) into
$c->request->arguments
Modified: Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/lib/Catalyst/Plugin/Unicode/Encoding.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/lib/Catalyst/Plugin/Unicode/Encoding.pm 2010-03-07 22:49:01 UTC (rev 13023)
+++ Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/lib/Catalyst/Plugin/Unicode/Encoding.pm 2010-05-04 18:52:41 UTC (rev 13212)
@@ -7,7 +7,7 @@
use Encode 2.21 ();
use MRO::Compat;
-our $VERSION = '0.9';
+our $VERSION = '0.10';
our $CHECK = Encode::FB_CROAK | Encode::LEAVE_SRC;
__PACKAGE__->mk_classdata('_encoding');
@@ -110,7 +110,7 @@
my $enc = $c->encoding;
- foreach (@{$c->req->arguments}) {
+ foreach (@{$c->req->arguments}, @{$c->req->captures}) {
$_ = Encode::is_utf8( $_ ) ? $_ : $enc->decode( $_, $CHECK );
}
Modified: Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/t/06request_decode.t
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/t/06request_decode.t 2010-03-07 22:49:01 UTC (rev 13023)
+++ Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/t/06request_decode.t 2010-05-04 18:52:41 UTC (rev 13212)
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 6 * 3;
+use Test::More tests => 7 * 3;
use utf8;
# setup library path
@@ -31,8 +31,8 @@
);
check_argument(GET "/$escape_str");
+check_capture(GET "/capture/$escape_str");
-
sub check_parameter {
my ( undef, $c ) = ctx_request(shift);
is $c->res->output => '<h1>It works</h1>';
@@ -59,3 +59,11 @@
is $foo => $decode_str;
}
+sub check_capture {
+ my ( undef, $c ) = ctx_request(shift);
+ is $c->res->output => '<h1>It works</h1>';
+
+ my $foo = $c->req->captures->[0];
+ ok utf8::is_utf8($foo);
+ is $foo => $decode_str;
+}
Modified: Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/trunk/t/lib/TestApp/Controller/Root.pm 2010-03-07 22:49:01 UTC (rev 13023)
+++ Catalyst-Plugin-Unicode-Encoding/branches/decode_captures/t/lib/TestApp/Controller/Root.pm 2010-05-04 18:52:41 UTC (rev 13212)
@@ -51,4 +51,11 @@
$c->response->body($main::TEST_FILE); # filehandle from test file
}
+sub capture : Chained('/') CaptureArgs(1) {}
+
+sub decode_capture : Chained('capture') PathPart('') Args(0) {
+ my ( $self, $c, $cap_arg ) = @_;
+ $c->forward('main');
+}
+
1;
More information about the Catalyst-commits
mailing list