mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-05-02 12:10 am

[dw-free] Add cookie support to DW::Request

[commit: http://hg.dwscoalition.org/dw-free/rev/2e0690ee55e1]

http://bugs.dwscoalition.org/show_bug.cgi?id=2446

Fix issue with requesting a cookie that doesn't exist.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/DW/Request/Base.pm
--------------------------------------------------------------------------------
diff -r 48a202889c55 -r 2e0690ee55e1 cgi-bin/DW/Request/Base.pm
--- a/cgi-bin/DW/Request/Base.pm	Sun May 02 00:07:42 2010 +0000
+++ b/cgi-bin/DW/Request/Base.pm	Sun May 02 00:10:33 2010 +0000
@@ -39,8 +39,8 @@ sub cookie {
     my DW::Request::Base $self = $_[0];
 
     $self->parse( $self->header_in( 'Cookie' ) ) unless defined $self->{cookies_in};
-    my $val = $self->{cookies_in}->{$_[1]};
-    return wantarray ? @{ $val } : $val->[0];
+    my $val = $self->{cookies_in}->{$_[1]} || [];
+    return wantarray ? @$val : $val->[0];
 }
 
 sub cookie_multi {
--------------------------------------------------------------------------------