Skip Menu |
 

This queue is for tickets about the namespace-clean CPAN distribution.

Report information
The Basics
Id: 47141
Status: resolved
Priority: 0/
Queue: namespace-clean

People
Owner: Nobody in particular
Requestors: ben [...] morrow.me.uk
Cc:
AdminCc:

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



Subject: Other entries in the glob are not restored properly
Date: Fri, 19 Jun 2009 09:49:37 +0100
To: bug-namespace-clean [...] rt.cpan.org
From: Ben Morrow <ben [...] morrow.me.uk>
Download (untitled) / with headers
text/plain 979b
namespace::clean currently doesn't restore the other entries in the glob properly when it deletes a function. The attached test program demonstrates the failure. Fixing the obvious error: --- clean.orig 2009-06-19 09:41:16.000000000 +0100 +++ lib/namespace/clean.pm 2009-06-19 09:41:31.000000000 +0100 @@ -166,9 +166,11 @@ next SYMBOL if $store->{exclude}{ $f }; no strict 'refs'; + local *__tmp; + # keep original value to restore non-code slots { no warnings 'uninitialized'; # fix possible unimports - local *__tmp = *{ ${ "${cleanee}::" }{ $f } }; + *__tmp = *{ ${ "${cleanee}::" }{ $f } }; delete ${ "${cleanee}::" }{ $f }; } makes some but not all of the failures go away; most annoyingly, at least here the SCALAR slot always seems to end up getting wiped. I don't really know what's going on here: it's quite possible the remaining failures are actually bugs in perl. Ben
Download 06-other-types.t
text/x-perl 1.7k

Message body is not shown because sender requested not to inline it.

Download OtherTypes.pm
text/x-perl 243b

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #47141] Other entries in the glob are not restored properly
Date: Sat, 20 Jun 2009 15:08:05 +0100
To: Bugs in namespace-clean via RT <bug-namespace-clean [...] rt.cpan.org>
From: Ben Morrow <ben [...] morrow.me.uk>
Download (untitled) / with headers
text/plain 376b
OK, I've worked out what's going on: *x = *y{FORMAT}; is putting the FORMAT ref into the SCALAR slot by mistake. Since formats aren't much used, I think the best thing to do is to just forget about coying the format across, and avoid clobbering the scalar. The attached patch does this, documents that fact, and includes a modified version of the previous tests. Ben

Message body is not shown because sender requested not to inline it.

Download (untitled) / with headers
text/plain 101b
That modified testcase passes, even without your namespace::clean modifications. Is that intentional?
Subject: Re: [rt.cpan.org #47141] Other entries in the glob are not restored properly
Date: Tue, 30 Jun 2009 12:24:16 +0100
To: Florian Ragwitz via RT <bug-namespace-clean [...] rt.cpan.org>
From: Ben Morrow <ben [...] morrow.me.uk>
Download (untitled) / with headers
text/plain 845b
At 1AM -0400 on 30/06/09 you (Florian Ragwitz via RT) wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=47141 > > > That modified testcase passes, even without your namespace::clean > modifications. Is that intentional?
...you're right, so it does. No, it wasn't intentional. t/lib/OtherTypes.pm should have sub foo { 1 } use namespace::clean; rather than the other way around. Sorry about that. Investigating this perl bug a little further, I've found that it's only present on 5.8.9 and 5.10.0: 5.10.1 will have a fix when it comes out. It might be worth using something like use constant CAN_COPY_FORMAT => do { local *foo, *bar; eval "format foo=\n.\n"; my $sc = *bar{SCALAR}; *bar = *foo{FORMAT}; *bar{SCALAR} == $sc; }; to test if FORMAT can be copied or not. Ben
Has been fixed a while ago (0.12)


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.