X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=509585f218c4dcdc9814e0fa67ae24484945a2ea;hp=b0a7014862fcdd5e0365d60391d65b8b4df17006;hb=671123ba662cd4d38ee2590baad2b9f46947cb4e;hpb=c96cdcef894409be1a70c0d0876c05d5d0687a22 diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index b0a7014..509585f 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -115,7 +115,7 @@ sub _dump_error_page_element { # This is fugly, but the metaclass is _HUGE_ and demands waaay too much # scrolling. Suggestions for more pleasant ways to do this welcome. local $val->{'__MOP__'} = "Stringified: " - . $val->{'__MOP__'} if exists $val->{'__MOP__'}; + . $val->{'__MOP__'} if ref $val eq 'HASH' && exists $val->{'__MOP__'}; my $text = encode_entities( dump( $val )); sprintf <<"EOF", $name, $text; @@ -280,7 +280,8 @@ sub finalize_error { - # Trick IE + # Trick IE. Old versions of IE would display their own error page instead + # of ours if we'd give it less than 512 bytes. $c->res->{body} .= ( ' ' x 512 ); # Return 500 @@ -310,6 +311,8 @@ Clean up after uploads, deleting temp files. sub finalize_uploads { my ( $self, $c ) = @_; + # N.B. This code is theoretically entirely unneeded due to ->cleanup(1) + # on the HTTP::Body object. my $request = $c->request; foreach my $key (keys %{ $request->uploads }) { my $upload = $request->uploads->{$key}; @@ -334,6 +337,7 @@ sub prepare_body { unless ( $request->_body ) { my $type = $request->header('Content-Type'); $request->_body(HTTP::Body->new( $type, $length )); + $request->_body->cleanup(1); # Make extra sure! $request->_body->tmpdir( $appclass->config->{uploadtmp} ) if exists $appclass->config->{uploadtmp}; } @@ -542,7 +546,7 @@ sub prepare_uploads { my $u = Catalyst::Request::Upload->new ( size => $upload->{size}, - type => $headers->content_type, + type => scalar $headers->content_type, headers => $headers, tempname => $upload->{tempname}, filename => $upload->{filename}, @@ -704,13 +708,13 @@ sub unescape_uri { =head2 $self->env -Hash containing enviroment variables including many special variables inserted +Hash containing environment variables including many special variables inserted by WWW server - like SERVER_*, REMOTE_*, HTTP_* ... -Before accesing enviroment variables consider whether the same information is +Before accessing environment variables consider whether the same information is not directly available via Catalyst objects $c->request, $c->engine ... -BEWARE: If you really need to access some enviroment variable from your Catalyst +BEWARE: If you really need to access some environment variable from your Catalyst application you should use $c->engine->env->{VARNAME} instead of $ENV{VARNAME}, as in some enviroments the %ENV hash does not contain what you would expect.