From: Yuval Kogman Date: Sat, 24 Jun 2006 11:59:15 +0000 (+0000) Subject: Avoid dying when $c->ref->body is a ref but not an object X-Git-Tag: 5.7099_04~466 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=f9b6d6122c224d2a46e1bcc4f0c98b16d0db21ce Avoid dying when $c->ref->body is a ref but not an object --- diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index ce90738..3a73c04 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -41,7 +41,8 @@ Finalize body. Prints the response output. sub finalize_body { my ( $self, $c ) = @_; my $body = $c->response->body; - if ( ref $body && ( $body->can('read') || ref($body) eq 'GLOB' ) ) { + no warnings 'uninitialized'; + if ( Scalar::Util::blessed($body) && $body->can('read') or ref($body) eq 'GLOB' ) { while ( !eof $body ) { read $body, my ($buffer), $CHUNKSIZE; last unless $self->write( $c, $buffer );