as_psgi and to_app
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
old mode 100755 (executable)
new mode 100644 (file)
index 7e1aed7..23ac3ad
@@ -127,7 +127,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
 __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC);
 
 # Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90069_002';
+our $VERSION = '5.90080_001';
 
 sub import {
     my ( $class, @arguments ) = @_;
@@ -2993,7 +2993,9 @@ sub apply_default_middlewares {
     return $psgi_app;
 }
 
-=head2 $c->psgi_app
+=head2 App->psgi_app
+
+=head2 App->to_app
 
 Returns a PSGI application code reference for the catalyst application
 C<$c>. This is the bare application without any middlewares
@@ -3004,6 +3006,8 @@ reference of your Catalyst application for use in F<.psgi> files.
 
 =cut
 
+*to_app = \&psgi_app;
+
 sub psgi_app {
     my ($app) = @_;
     my $psgi = $app->engine->build_psgi_app($app);
@@ -3071,6 +3075,7 @@ sub _handle_unicode_decoding {
 
     return unless defined $value;
 
+    ## I think this mess is to support the old nested
     if ( ref $value eq 'ARRAY' ) {
         foreach ( @$value ) {
             $_ = $self->_handle_unicode_decoding($_);
@@ -3090,6 +3095,8 @@ sub _handle_unicode_decoding {
 
 sub _handle_param_unicode_decoding {
     my ( $self, $value ) = @_;
+    return unless defined $value; # not in love with just ignoring undefs - jnap
+
     my $enc = $self->encoding;
     return try {
         Encode::is_utf8( $value ) ?