Ok I have read every archived posting on LWP:UserAgent and HTTP::Cookies and no, I still don't get it. Yes I am probably increadibly lame. I keep missing something about setting cookies. What I am trying to do is post to a remote server which then logs the cookie I send it. I can't send the cookie as a form attribute, so I have to set the cookie to whatever the user's cookie is. The problem is that when I try to set $cookie_jar->add_cookie_header($ENV{HTTP_COOKIE}); It complains greatly about: Can't locate object method "url" via package "<$ENV{HTTP_COOKIE}>" at /usr/local/lib/perl5/site_perl/5.005/HTTP/Cookies.pm line 106. Here is the code:
use LWP::UserAgent; use HTTP::Cookies; use HTTP::Request::Common qw(POST); my $ua = new LWP::UserAgent; my $cookie_jar = new HTTP::Cookies; $cookie_jar->add_cookie_header($ENV{HTTP_COOKIE}); #This line is troub +lesome my $req = POST 'http://foo.com/cgi-bin/log_cookie.cgi', [ data => 'somedata', errors => 'probably' ]; print $ua->request($req)->as_string;

In reply to LWP and slow learners by codemonkey

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.