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=7f7a661b088950e44ae03c003079a47a338ce5e4;hp=de506cb54af73eff4b1601153098817888eb5fa0;hb=e80e8542290e1c62b3c6dbee4265691d7ad634c3;hpb=f63c03e47ae0278e50d513b90ecbbdfd67d1a021 diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index de506cb..7f7a661 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -2,7 +2,7 @@ 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; @@ -54,7 +54,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 @@ -62,15 +63,18 @@ sub finalize_cookies { my ( $self, $c ) = @_; my @cookies; - while ( my ( $name, $cookie ) = each %{ $c->response->cookies } ) { - my $cookie = CGI::Cookie->new( + foreach my $name ( keys %{ $c->response->cookies } ) { + + my $val = $c->response->cookies->{$name}; + + my $cookie = CGI::Simple::Cookie->new( -name => $name, - -value => $cookie->{value}, - -expires => $cookie->{expires}, - -domain => $cookie->{domain}, - -path => $cookie->{path}, - -secure => $cookie->{secure} || 0 + -value => $val->{value}, + -expires => $val->{expires}, + -domain => $val->{domain}, + -path => $val->{path}, + -secure => $val->{secure} || 0 ); push @cookies, $cookie->as_string; @@ -360,7 +364,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 @@ -368,7 +372,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) } ); } } @@ -388,13 +392,15 @@ sub prepare_parameters { my ( $self, $c ) = @_; # We copy, no references - while ( my ( $name, $param ) = each %{ $c->request->query_parameters } ) { + foreach my $name ( keys %{ $c->request->query_parameters } ) { + my $param = $c->request->query_parameters->{$name}; $param = ref $param eq 'ARRAY' ? [ @{$param} ] : $param; $c->request->parameters->{$name} = $param; } # Merge query and body parameters - while ( my ( $name, $param ) = each %{ $c->request->body_parameters } ) { + foreach my $name ( keys %{ $c->request->body_parameters } ) { + my $param = $c->request->body_parameters->{$name}; $param = ref $param eq 'ARRAY' ? [ @{$param} ] : $param; if ( my $old_param = $c->request->parameters->{$name} ) { if ( ref $old_param eq 'ARRAY' ) {