##
Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT
Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/
####
Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001
####
use LWP::UserAgent;
use HTTP::Cookies;
my $url = "http://localhost/cgi-bin/test.pl";
my $lwp = LWP::UserAgent->new( );
my $cookie_jar = HTTP::Cookies->new;
$lwp->cookie_jar( $cookie_jar );
my $response = $lwp->get($url);
print $response->as_string;
my %hash;
$cookie_jar->scan( sub { $hash{$_[1]} = $_[2] } );
print "\n\nCookies baked:\n";
print "$_:$hash{$_}\n" for keys %hash;
__DATA__
HTTP/1.1 200 OK
Connection: close
Date: Thu, 24 Apr 2008 12:59:39 GMT
Server: Apache/2.2.8 (Win32)
Content-Type: text/html
Client-Date: Thu, 24 Apr 2008 12:59:39 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Set-Cookie: JSESSID=1234
Set-Cookie: PCLT=5678
Hello!
Cookies baked:
PCLT:5678
JSESSID:1234