Reputation: 378
This is my perl script:
#!/usr/local/perl
use strict;
use warnings;
use LWP 5.64;
use HTTP::Cookies;
my $browser=LWP::UserAgent->new;
$browser->agent('Mozilla/5.0'); #etc
my $cookie_jar=HTTP::Cookies->new(
file => '/home/andrew/Documents/Perl/CheckResultsURL/cookies.txt',
autosave => 1,
);
$browser->$cookie_jar($cookie_jar);
my $url="http://scholar.google.com/scholar?hl=en&q=john";
#send request
my $response=$browser->get($url);
if($response->content=~/about(\s)((\d)+)/){
print "yes";
}
print $response->content;
I get this error:
Can't locate object method "Cookies=HASH(0x22bf388)" via package "HTTP" at lwp.pl line 17.
And sadly I don't know what to do. Probably it has to do with a cookie control I don't pass. Any help?
Upvotes: 0
Views: 73
Reputation: 15917
I believe the line $browser->$cookie_jar($cookie_jar);
should probably be $browser->cookie_jar($cookie_jar);
(note removal of extra '$')
Upvotes: 3