I'm slowly going nuts!
Either I'm making this much too difficult or, more likely, I just don't get it. I've read though the above posts and I'm still missing it.
I have a number of .cgi web-pages that use a cookie for user authentication and I sometimes want to access these via LWP (which needs to pass the cookie.)
Here's my latest, not working, version. It runs ok, but it's not passing the cookie.
use strict;
use CGI;
use LWP::UserAgent;
use HTTP::Cookies;
my $q = new CGI;
my $cookie_value = $q->cookie('name'); # Get cookie from bowser
my $ua = LWP::UserAgent->new;
my $cookie_jar = HTTP::Cookies->new;
# Pass cookie in LWP.
my $version = ''; # (from CPAN) What's this?
$cookie_jar -> set_cookie($version,'name',$cookie_value,"/");
$ua -> cookie_jar($cookie_jar);
my $form_data = [ name => 'value', ];
my $response = $ua->post("http://domain.com/cgi-bin/script.cgi",$form_
+data);
$html = ($response->is_success) ? $response->content : "Page not respo
+nding";