No, it says:

SYNOPSIS use LWP::UserAgent; use HTTP::CookieJar::LWP; my $ua = LWP::UserAgent->new( cookie_jar => HTTP::CookieJar::LWP->new );
and then it says
DESCRIPTION This module is an experimental adapter to make HTTP::CookieJar work wi +th LWP.
So you go read the docs for HTTP::CookieJar and find that they are comprehensive. You may also need to read some of the docs for LWP::UserAgent.

Here is a simple example:

#! perl use strict; use warnings; use feature qw/ say /; use Data::Dumper; use LWP::UserAgent; use HTTP::CookieJar::LWP; my $protocol = 'http://'; my $domain = 'www.foobar.com'; my $path = '/baz'; my $page = '/qux.html'; my $url = join '', $protocol, $domain, $path, $page; my $file = 'cookies.txt'; ## Only here for demo. You would have a cookie file ## made somewhere else, or if not you would pass the ## values directly to HTTP::CookieJar::LWP::add() open( my $write_handle, '>', $file ) or die "open: $!\n"; print $write_handle "Secret_Number=42; Max-Age=300; Domain=$domain; Pa +th=$path\n"; close $write_handle or die "close: $!\n"; my $ua = LWP::UserAgent->new( cookie_jar => HTTP::CookieJar::LWP->new() ); open( my $read_handle, '<', $file ) or die "open: $!\n"; foreach my $cookie ( <$read_handle> ) { chomp $cookie; $ua->cookie_jar->add( $url, $cookie ); } say $ua->cookie_jar->cookie_header( $url ); say Dumper $ua->cookie_jar->cookies_for( $url ); __END__
Output:
[00:04][nick:~/monks]$ perl 1139766.pl Secret_Number=42 $VAR1 = { 'name' => 'Secret_Number', 'domain' => 'www.foobar.com', 'expires' => 1440486562, 'value' => '42', 'path' => '/baz', 'last_access_time' => 1440486262, 'creation_time' => 1440486262 };
Now you just GET the URL with LWP::UserAgent in the normal way, and the cookie goes right along in the headers.

Hope this helps!

The way forward always starts with a minimal test.

In reply to Re^3: Cannot create a cookie using HTTP::Cookies by 1nickt
in thread Cannot create a cookie using HTTP::Cookies by shagbark

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.