Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 97572
Status: resolved
Priority: 0/
Queue: Moose

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

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



Subject: The import, unimport, & init_meta subs created for the caller Moose::Exporter by should not be __ANON__
There are a couple ways we could fix this: * The simplest is to simply use subname() in Moose::Exporter before we call CMOP::Package->add_package_symbol - this should use a fully qualified name ($caller . '::import') * A possibly better way to do this is to add a new API to CMOP::Package, ->add_subroutine() - this would take an unqualified name ("import") and a subref and install the new sub _with_ the name. We would also want CMOP::Mixin::HasMethods->add_method to call this rather than duplicating the functionality there.
Also, init_meta should be installed differently than the rest of the subs -- perhaps with Sub::Install -- so Test::CleanNamespaces doesn't trip up on init_meta (as it is doing with today's commits to MooseX::Role::WithOverloading).
On Mon Jul 28 17:08:40 2014, ETHER wrote: Show quoted text
> Also, init_meta should be installed differently than the rest of the > subs -- perhaps with Sub::Install -- so Test::CleanNamespaces doesn't > trip up on init_meta (as it is doing with today's commits to > MooseX::Role::WithOverloading).
I'm not sure exactly how to test this without just adding Test::CleanNamespaces to our list of deps.
Subject: Re: [rt.cpan.org #97572] The import, unimport, & init_meta subs created for the caller Moose::Exporter by should not be __ANON__
Date: Sun, 3 Aug 2014 15:48:22 -0700
To: Dave Rolsky via RT <bug-Moose [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Sun, Aug 03, 2014 at 06:30:30PM -0400, Dave Rolsky via RT wrote: Show quoted text
> I'm not sure exactly how to test this without just adding Test::CleanNamespaces to our list of deps.
That wouldn't be a big deal, since it's just built on top of namespace::autoclean -- or you can rip out the relevant guts of TCN and use that directly instead, snipping out all the bits that aren't relevant: my $all_symbols = Package::Stash->new($ns)->get_all_symbols('CODE'); my %subs = %$all_symbols; # ugh, this returns far more than the true list of methods delete @subs{ $meta->get_method_list }; @imports = keys %subs; my %imports; @imports{@imports} = map { sub_fullname($symbols->{$_}) } @imports; # these subs are special-cased - they are often provided by other # modules, but cannot be wrapped with Sub::Name as the call stack # is important delete @imports{qw(import unimport)}; my @overloads = grep { $imports{$_} eq 'overload::nil' } keys %imports; delete @imports{@overloads} if @overloads; if ($] < 5.010) { my @constants = grep { $imports{$_} eq 'constant::__ANON__' } keys %imports; delete @imports{@constants} if @constants; }