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> |
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
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.