X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine.pm;h=ce90738e81671ec7bf3debb8e5c8d42722aaf376;hb=b7ce908fc5c404dcbc480c7ecf9a275b92fcc26f;hp=6e46c813c883391a9d68c5873641ee6d20071274;hpb=c82ed742c266d6ad53cf3f18214d392cd6d188f7;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 6e46c81..ce90738 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -2,12 +2,13 @@ package Catalyst::Engine; use strict; use base 'Class::Accessor::Fast'; -use CGI::Cookie; +use CGI::Simple::Cookie; use Data::Dump qw/dump/; 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/); @@ -54,7 +55,8 @@ sub finalize_body { =head2 $self->finalize_cookies($c) -Create CGI::Cookies from $c->res->cookies, and set them as response headers. +Create CGI::Simple::Cookie objects from $c->res->cookies, and set them as +response headers. =cut @@ -67,13 +69,17 @@ sub finalize_cookies { my $val = $c->response->cookies->{$name}; - my $cookie = CGI::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; @@ -363,7 +369,7 @@ sub prepare_connection { } =head2 $self->prepare_cookies($c) -Parse cookies from header. Sets a L object. +Parse cookies from header. Sets a L object. =cut @@ -371,7 +377,7 @@ sub prepare_cookies { my ( $self, $c ) = @_; if ( my $header = $c->request->header('Cookie') ) { - $c->req->cookies( { CGI::Cookie->parse($header) } ); + $c->req->cookies( { CGI::Simple::Cookie->parse($header) } ); } }