Subject: | about sub cookie_jar (libwww-perl-6.15 > LWP::UserAgent) |
Date: | Sat, 28 May 2016 19:23:36 +0900 |
To: | bug-libwww-perl [...] rt.cpan.org |
From: | 中村剛 <tsuyo61 [...] gmail.com> |
Hello.
I'm Japanese.
Sorry. I'm weak in English.
It is this error message I get.
code sub {
package LWP::UserAgent;
use strict;
$jar->add_cookie_header($_[0]);
} caused an error: Global symbol "$jar" requires explicit package name
Is there a problem in this place?
libwww-perl-6.15 > LWP::UserAgent
sub cookie_jar {
my $self = shift;
my $old = $self->{cookie_jar};
if (@_) {
my $jar = shift;
if (ref($jar) eq "HASH") {
require HTTP::Cookies;
$jar = HTTP::Cookies->new(%$jar);
}
$self->{cookie_jar} = $jar;
$self->set_my_handler("request_prepare",
$jar ? sub { $jar->add_cookie_header($_[0]); } : undef,
);
$self->set_my_handler("response_done",
$jar ? sub { $jar->extract_cookies($_[0]); } : undef,
);
}
$old;
}
I'm using perl version v5.16.3.
Thank you for your attention.