in reply to Can't call method "extract_cookies" on an undefined value

In your code, $cookie_jar is declared, but never assigned.

So, it croaks when you try to call a method on it.

I think you need:

$ua->cookie_jar ($cookie_jar={}); # instead of $ua->cookie_jar ( {} );
(untested)

        The best defense against logic is ignorance.

Replies are listed 'Best First'.
Re^2: Can't call method "extract_cookies" on an undefined value
by Todd Chester (Scribe) on Oct 17, 2015 at 05:39 UTC

    That helped. Now I am getting an even sillier error:

    Can't call method "extract_cookies" on unblessed reference at ./GetJavaTest.pl line 53 (#1)

    changing line 53 to:

    $cookie_jar->HTTP::Cookies::extract_cookies($response);

    give the same error:

     Can't call method "HTTP::Cookies::extract_cookies" on unblessed reference at ./GetJavaTest.pl line 53.

    What is an "unblessed reference" anyway?

      When I look at the web page it downloads, I find

      writeSessionCookie( 'oraclelicense', 'accept-securebackup-cookie' );

      in it

      Be nice if I could just add the cookie directly, like I can do with wget.

        $ua = LWP::UserAgent->new; $ua->cookie_jar ($cookie_jar={}); # instead of $ua->cooki +e_jar ( +{} ); $request = HTTP::Request->new('GET', "$RevAddr" ); print "\$request = ", $request, "\n"; print Dumper ($request), "\n";

        $request = HTTP::Request=HASH(0x1080540) $VAR1 = bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'http://www.ora +cle.com/ +technetwork/java/javase/downloads/jre7-downloads-1880261.html +')}, 'UR +I::http' ), '_headers' => bless( {}, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' );

        What am I doing wrong?