Skip Menu |

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

Report information
The Basics
Id: 110153
Status: open
Priority: 0/
Queue: namespace-autoclean

People
Owner: Nobody in particular
Requestors: OSCHWALD [...] cpan.org
Cc:
AdminCc:

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



Subject: Imported constants are not cleaned up
It appears that at least some imported constants are not cleaned up properly. For instance, the attached test fails on 0.28. Greg
Subject: imported-constant.t
use strict; use warnings; use Test::More; { package Foo; use Fcntl qw( O_CREAT ); use namespace::autoclean; } ok(!Foo->can('O_CREAT'), 'imported constant is cleaned up'); done_testing;
On 2015-12-07 15:28:01, OSCHWALD wrote: Show quoted text
> It appears that at least some imported constants are not cleaned up > properly. > > For instance, the attached test fails on 0.28. > > Greg
I don't think we can fix that particular case, because of this: https://metacpan.org/source/RJBS/perl-5.22.0/ext/Fcntl/Fcntl.pm#L88 You'll have to do: use namespace::autoclean -also => [ 'O_CREAT' ];
On 2015-12-07 16:12:43, ETHER wrote: Show quoted text
> On 2015-12-07 15:28:01, OSCHWALD wrote:
> > It appears that at least some imported constants are not cleaned up > > properly. > > > > For instance, the attached test fails on 0.28. > > > > Greg
> > > I don't think we can fix that particular case, because of this:
Er, no, belay that -- I misread the code. I'll look into this further tonight.
On 2015-12-07 16:13:34, ETHER wrote: Show quoted text
> On 2015-12-07 16:12:43, ETHER wrote:
> > On 2015-12-07 15:28:01, OSCHWALD wrote:
> > > It appears that at least some imported constants are not cleaned up > > > properly. > > > > > > For instance, the attached test fails on 0.28.
It appears that constants coming from the XS code are treated differently than those defined as perl subs -- as expected, any regular sub defined in Fcntl and exported will be properly detected and cleaned up. This might be an XSLoader bug?
Show quoted text
> It appears that constants coming from the XS code are treated > differently than those defined as perl subs -- as expected, any > regular sub defined in Fcntl and exported will be properly detected > and cleaned up. This might be an XSLoader bug?
I agree that this does not occur with regular subs. I do however experience the same issue when using the constant pragma, which does not appear to use XS. Greg
constants from either the pragma or XS are not implemented as subs (on perl >= 5.10). The source package is not stored with them. There isn't really anything we can do about this. The only choices are to clean all constants or no constants, and document the behavior. In perl 5.8, we'll end up cleaning constants created using the pragma, since they will show as coming from the 'constant' package.