X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FUnicode%2FEncoding.pm;h=7c61530896c503a5f55e427e0ba45e6c31a66733;hb=c396cfc71169fc01ede2b891c197be02791ee2aa;hp=6da27ad60c00936f0af8e586d08f35258220af4e;hpb=a6a3355ffafb71e9a52b0ac5a533dc9cb6f8ba8b;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Plugin/Unicode/Encoding.pm b/lib/Catalyst/Plugin/Unicode/Encoding.pm index 6da27ad..7c61530 100644 --- a/lib/Catalyst/Plugin/Unicode/Encoding.pm +++ b/lib/Catalyst/Plugin/Unicode/Encoding.pm @@ -81,6 +81,7 @@ sub prepare_uploads { $c->next::method(@_); my $enc = $c->encoding; + return unless $enc; for my $key (qw/ parameters query_parameters body_parameters /) { for my $value ( values %{ $c->request->{$key} } ) { @@ -114,6 +115,9 @@ sub prepare_action { my $ret = $c->next::method(@_); + my $enc = $c->encoding; + return $ret unless $enc; + foreach (@{$c->req->arguments}, @{$c->req->captures}) { $_ = $c->_handle_param_unicode_decoding($_); } @@ -126,12 +130,12 @@ sub setup { my $conf = $self->config; - # Allow an explict undef encoding to disable default of utf-8 + # Allow an explicit undef encoding to disable default of utf-8 my $enc = delete $conf->{encoding}; $self->encoding( $enc ); return $self->next::method(@_) - unless $self->setup_finished; ## hack to stop possibily meaningless test fail... (jnap) + unless $self->setup_finished; ## hack to stop possibly meaningless test fail... (jnap) } sub _handle_unicode_decoding { @@ -175,8 +179,7 @@ sub _handle_param_unicode_decoding { sub handle_unicode_encoding_exception { my ( $self, $exception_ctx ) = @_; - $self->log->warn($exception_ctx->{error_msg}); - return $exception_ctx->{'param_value'}; + die $exception_ctx->{error_msg}; } 1; @@ -198,7 +201,7 @@ Catalyst::Plugin::Unicode::Encoding - Unicode aware Catalyst This plugin is automatically loaded by apps. Even though is not a core component yet, it will vanish as soon as the code is fully integrated. For more -information, please refer to C section at L. +information, please refer to L. =head1 AUTHORS