X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=3a73c04fa2a7b8df2308410139be1c67ccba188f;hb=264bac8c94a84d7dbac9912946d1a639fa37d1cd;hp=7f7a661b088950e44ae03c003079a47a338ce5e4;hpb=fa32ac82eacd5c38b4b4dda10c472901a59c72fe;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 7f7a661..3a73c04 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -8,6 +8,7 @@ use HTML::Entities; use HTTP::Body; use HTTP::Headers; use URI::QueryParam; +use Scalar::Util (); # input position and length __PACKAGE__->mk_accessors(qw/read_position read_length/); @@ -40,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 ); @@ -68,13 +70,17 @@ sub finalize_cookies { my $val = $c->response->cookies->{$name}; - my $cookie = CGI::Simple::Cookie->new( - -name => $name, - -value => $val->{value}, - -expires => $val->{expires}, - -domain => $val->{domain}, - -path => $val->{path}, - -secure => $val->{secure} || 0 + my $cookie = ( + Scalar::Util::blessed($val) + ? $val + : CGI::Simple::Cookie->new( + -name => $name, + -value => $val->{value}, + -expires => $val->{expires}, + -domain => $val->{domain}, + -path => $val->{path}, + -secure => $val->{secure} || 0 + ) ); push @cookies, $cookie->as_string;