Skip Menu |
 

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 114785
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: tsuyo61 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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>
Download (untitled) / with headers
text/plain 928b
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.
Download (untitled) / with headers
text/plain 399b
On 2016-05-28 03:24:24, tsuyo61@gmail.com wrote: Show quoted text
> 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
It should work. Can you show me your code where you are calling $ua->cookie_jar?
Subject: Re: [rt.cpan.org #114785] about sub cookie_jar (libwww-perl-6.15 > LWP::UserAgent)
Date: Sun, 29 May 2016 17:57:26 +0900
To: bug-libwww-perl [...] rt.cpan.org
From: 中村剛 <tsuyo61 [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
Thank you for reply. As shown in the following example: ----------------------------------------------------------------------- #!/usr/bin/perl use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use HTTP::Cookies; use Storable qw(nstore store_fd nstore_fd freeze nfreeze thaw dclone); use LWP::UserAgent; local $Storable::Deparse = 1; local $Storable::Eval = 1; my $ua = new LWP::UserAgent(cookie_jar => HTTP::Cookies->new()); my $uafrozen = Storable::freeze $ua; my $newua = Storable::thaw $uafrozen; ----------------------------------------------------------------------- 「Storable::thaw」 Here error occurs. Thank you for your attention. 2016-05-29 3:09 GMT+09:00 Karen Etheridge via RT <bug-libwww-perl@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=114785 > > > On 2016-05-28 03:24:24, tsuyo61@gmail.com wrote:
>> 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
> > > It should work. Can you show me your code where you are calling $ua->cookie_jar?
Download (untitled) / with headers
text/plain 1.9k
This is a limitation of the Deparse/Eval support in Storable.pm: lexical variables defined outside of a closure cannot be restored. Here's a simple test case without libwww-perl involved: #!perl use strict; use Storable qw(dclone); local $Storable::Deparse = 1; local $Storable::Eval = 1; my $sub = do { my $foo; sub { $foo }; }; dclone $sub; __END__ Error message is: code sub { use strict; $foo; } caused an error: Global symbol "$foo" requires explicit package name at (eval 7) line 3. This limitation should at least be documented in Storable.pm. Maybe it could be fixed by using something like PadWalker or so. On 2016-05-29 04:58:20, tsuyo61@gmail.com wrote: Show quoted text
> Thank you for reply. > > As shown in the following example: > > ----------------------------------------------------------------------- > #!/usr/bin/perl > > use strict; > use warnings; > > use CGI::Carp qw(fatalsToBrowser); > use HTTP::Cookies; > use Storable qw(nstore store_fd nstore_fd freeze nfreeze thaw dclone); > use LWP::UserAgent; > > local $Storable::Deparse = 1; > local $Storable::Eval = 1; > > my $ua = new LWP::UserAgent(cookie_jar => HTTP::Cookies->new()); > my $uafrozen = Storable::freeze $ua; > my $newua = Storable::thaw $uafrozen; > > ----------------------------------------------------------------------- > > 「Storable::thaw」 > Here error occurs. > > Thank you for your attention. > > > > 2016-05-29 3:09 GMT+09:00 Karen Etheridge via RT <bug-libwww- > perl@rt.cpan.org>:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=114785 > > > > > On 2016-05-28 03:24:24, tsuyo61@gmail.com wrote:
> >> 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
> > > > > > It should work. Can you show me your code where you are calling $ua-
> > >cookie_jar?
Subject: Re: [rt.cpan.org #114785] about sub cookie_jar (libwww-perl-6.15 > LWP::UserAgent)
Date: Sun, 12 Jun 2016 09:49:09 +0900
To: bug-libwww-perl [...] rt.cpan.org
From: 中村剛 <tsuyo61 [...] gmail.com>
Download (untitled) / with headers
text/plain 2.2k
I see. Thank You. 2016/06/12 1:40 "Slaven_Rezic via RT" <bug-libwww-perl@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=114785 > > > This is a limitation of the Deparse/Eval support in Storable.pm: lexical > variables defined outside of a closure cannot be restored. Here's a simple > test case without libwww-perl involved: > > #!perl > use strict; > use Storable qw(dclone); > > local $Storable::Deparse = 1; > local $Storable::Eval = 1; > > my $sub = do { > my $foo; > sub { $foo }; > }; > > dclone $sub; > __END__ > > Error message is: > > code sub { > use strict; > $foo; > } caused an error: Global symbol "$foo" requires explicit package name at > (eval 7) line 3. > > > This limitation should at least be documented in Storable.pm. Maybe it > could be fixed by using something like PadWalker or so. > > On 2016-05-29 04:58:20, tsuyo61@gmail.com wrote:
> > Thank you for reply. > > > > As shown in the following example: > > > > ----------------------------------------------------------------------- > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > use CGI::Carp qw(fatalsToBrowser); > > use HTTP::Cookies; > > use Storable qw(nstore store_fd nstore_fd freeze nfreeze thaw dclone); > > use LWP::UserAgent; > > > > local $Storable::Deparse = 1; > > local $Storable::Eval = 1; > > > > my $ua = new LWP::UserAgent(cookie_jar => HTTP::Cookies->new()); > > my $uafrozen = Storable::freeze $ua; > > my $newua = Storable::thaw $uafrozen; > > > > ----------------------------------------------------------------------- > > > > 「Storable::thaw」 > > Here error occurs. > > > > Thank you for your attention. > > > > > > > > 2016-05-29 3:09 GMT+09:00 Karen Etheridge via RT <bug-libwww- > > perl@rt.cpan.org>:
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=114785 > > > > > > > On 2016-05-28 03:24:24, tsuyo61@gmail.com wrote:
> > >> 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
> > > > > > > > > It should work. Can you show me your code where you are calling $ua-
> > > >cookie_jar?
> > > >
Download (untitled) / with headers
text/plain 2.5k
On Sat Jun 11 20:49:23 2016, tsuyo61@gmail.com wrote: Show quoted text
> I see. > > Thank You. > 2016/06/12 1:40 "Slaven_Rezic via RT" <bug-libwww-perl@rt.cpan.org>: >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=114785 > > > > > This is a limitation of the Deparse/Eval support in Storable.pm: lexical > > variables defined outside of a closure cannot be restored. Here's a simple > > test case without libwww-perl involved: > > > > #!perl > > use strict; > > use Storable qw(dclone); > > > > local $Storable::Deparse = 1; > > local $Storable::Eval = 1; > > > > my $sub = do { > > my $foo; > > sub { $foo }; > > }; > > > > dclone $sub; > > __END__ > > > > Error message is: > > > > code sub { > > use strict; > > $foo; > > } caused an error: Global symbol "$foo" requires explicit package name at > > (eval 7) line 3. > > > > > > This limitation should at least be documented in Storable.pm. Maybe it > > could be fixed by using something like PadWalker or so. > > > > On 2016-05-29 04:58:20, tsuyo61@gmail.com wrote:
> > > Thank you for reply. > > > > > > As shown in the following example: > > > > > > ----------------------------------------------------------------------- > > > #!/usr/bin/perl > > > > > > use strict; > > > use warnings; > > > > > > use CGI::Carp qw(fatalsToBrowser); > > > use HTTP::Cookies; > > > use Storable qw(nstore store_fd nstore_fd freeze nfreeze thaw dclone); > > > use LWP::UserAgent; > > > > > > local $Storable::Deparse = 1; > > > local $Storable::Eval = 1; > > > > > > my $ua = new LWP::UserAgent(cookie_jar => HTTP::Cookies->new()); > > > my $uafrozen = Storable::freeze $ua; > > > my $newua = Storable::thaw $uafrozen; > > > > > > ----------------------------------------------------------------------- > > > > > > 「Storable::thaw」 > > > Here error occurs. > > > > > > Thank you for your attention. > > > > > > > > > > > > 2016-05-29 3:09 GMT+09:00 Karen Etheridge via RT <bug-libwww- > > > perl@rt.cpan.org>:
> > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=114785 > > > > > > > > > On 2016-05-28 03:24:24, tsuyo61@gmail.com wrote:
> > > >> 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
> > > > > > > > > > > > It should work. Can you show me your code where you are calling $ua-
> > > > >cookie_jar?
> > > > > > > >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.