1use strict; 2use CGI; 3use Test::More; 4 5{ 6 my $cgi = CGI->new; 7 my $got = $cgi->header( -cookie => 'foo' ); 8 my $expected = "^Set-Cookie: foo$CGI::CRLF" 9 . "Date: [^$CGI::CRLF]+$CGI::CRLF" 10 . 'Content-Type: text/html; charset=ISO-8859-1' 11 . $CGI::CRLF x 2; 12 like $got, qr($expected), 'cookie'; 13} 14 15{ 16 my $cgi = CGI->new; 17 my $got = $cgi->header( -cookie => [ 'foo', 'bar' ] ); 18 my $expected = "^Set-Cookie: foo$CGI::CRLF" 19 . "Set-Cookie: bar$CGI::CRLF" 20 . "Date: [^$CGI::CRLF]+$CGI::CRLF" 21 . 'Content-Type: text/html; charset=ISO-8859-1' 22 . $CGI::CRLF x 2; 23 like $got, qr($expected), 'cookie arrayref'; 24} 25 26{ 27 my $cgi = CGI->new; 28 my $got = $cgi->header( -cookie => q{} ); 29 my $expected = 'Content-Type: text/html; charset=ISO-8859-1' 30 . $CGI::CRLF x 2; 31 is $got, $expected, 'cookie empty string'; 32} 33 34done_testing; 35