nedals has asked for the wisdom of the Perl Monks concerning the following question:

I understand how to pass 'get' and 'post' data using LWP::UserAgent, but I need to pass a cookie. I read through CPAN's LWP and HTTP::Cookies and many of the posts on PM, but I'm just not getting it.

I see things like this that require a file to store cookies.

$cookie_jar = HTTP::Cookies->new(file => "$ENV{'HOME'}/lwp_cookies.dat +')

All I want to do is pass on a known cookie. So I tried this but it does not work.

use strict use CGI use LWP::UserAgent; ## Get cookie already set on browser. my $q = new CGI; my $value = $q->cookie('name'); my $ua = LWP::UserAgent->new; $ua->cookie_jar({ 'name'=> $value }); my $response = $ua->get(''); my $stats = ($response->is_success) ? $response->content : '';