[Catalyst-commits] r12342 - in
Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested:
. lib/Catalyst/Plugin/Unicode
chiba at dev.catalyst.perl.org
chiba at dev.catalyst.perl.org
Sun Dec 13 08:35:12 GMT 2009
Author: chiba
Date: 2009-12-13 08:35:12 +0000 (Sun, 13 Dec 2009)
New Revision: 12342
Modified:
Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/Makefile.PL
Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/lib/Catalyst/Plugin/Unicode/Encoding.pm
Log:
use Data::Rmap;
Modified: Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/Makefile.PL
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/Makefile.PL 2009-12-13 08:33:57 UTC (rev 12341)
+++ Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/Makefile.PL 2009-12-13 08:35:12 UTC (rev 12342)
@@ -4,7 +4,7 @@
requires 'Encode' => '2.21';
requires 'Catalyst' => '5.80';
-requires 'Data::Visitor::Callback';
+requires 'Data::Rmap';
test_requires 'Test::WWW::Mechanize::Catalyst' => 0.51;
test_requires 'IO::Scalar';
Modified: Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/lib/Catalyst/Plugin/Unicode/Encoding.pm
===================================================================
--- Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/lib/Catalyst/Plugin/Unicode/Encoding.pm 2009-12-13 08:33:57 UTC (rev 12341)
+++ Catalyst-Plugin-Unicode-Encoding/branches/support_params_nested/lib/Catalyst/Plugin/Unicode/Encoding.pm 2009-12-13 08:35:12 UTC (rev 12342)
@@ -7,7 +7,7 @@
use Encode 2.21 ();
use MRO::Compat;
-use Data::Visitor::Callback;
+use Data::Rmap;
our $VERSION = '0.5';
our $CHECK = Encode::FB_CROAK | Encode::LEAVE_SRC;
@@ -82,8 +82,10 @@
my $enc = $c->encoding;
- my $visitor = Data::Visitor::Callback->new(
- value => sub {
+ my $map_decoder = sub {
+ my $value = shift;
+
+ rmap {
return unless defined($_);
# N.B. Check if already a character string and if so do not try to double decode.
@@ -92,19 +94,16 @@
# same as not encoding on output which is bad news (as it does the wrong thing
# for latin1 chars for example)..
$_ = Encode::is_utf8( $_ ) ? $_ : $enc->decode( $_, $CHECK );
- },
- 'Catalyst::Request::Upload' => sub {
- $_->{filename} = $enc->decode( $_->{filename}, $CHECK )
- },
- );
+ } $value;
+ };
for my $key (qw/ parameters query_parameters body_parameters /) {
for my $value ( values %{ $c->request->{$key} } ) {
- $visitor->visit($value);
+ $map_decoder->(\$value);
}
}
for my $value ( values %{ $c->request->uploads } ) {
- $visitor->visit($value);
+ $map_decoder->(\$value);
}
}
More information about the Catalyst-commits
mailing list