Skip Menu |

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

Report information
The Basics
Id: 74674
Status: rejected
Priority: 0/
Queue: namespace-clean

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

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



Subject: Don't clean subs marked with the ":method" attribute
Perl has had attributes--and the builtin ":method" attribute--since v5.6.0. It would be convenient if namespace::clean automatically skipped over subs marked with ":method", since it's highly unlikely one would want to remove such a sub, and the attribute itself is harmless enough to not have to worry about side effects of applying it to all a class's methods.
On Fri Feb 03 21:49:02 2012, rsimoes wrote: Show quoted text
> Perl has had attributes--and the builtin ":method" attribute--since > v5.6.0. It would be convenient if namespace::clean automatically skipped > over subs marked with ":method", since it's highly unlikely one would > want to remove such a sub, and the attribute itself is harmless enough > to not have to worry about side effects of applying it to all a class's > methods.
namespace::autoclean is generally designed to do all this, without the insanity of littering your codebase with crazy attributes. Furthermore afaict you want this functionality because you want to ... import methods? Leaving the evilness of such an approach aside, perhaps ou were looking for (the equally evil) Sub::Exporter::ForMethods?
On Sun Feb 05 07:10:46 2012, RIBASUSHI wrote: Show quoted text
> On Fri Feb 03 21:49:02 2012, rsimoes wrote:
> > Perl has had attributes--and the builtin ":method" attribute--since > > v5.6.0. It would be convenient if namespace::clean automatically skipped > > over subs marked with ":method", since it's highly unlikely one would > > want to remove such a sub, and the attribute itself is harmless enough > > to not have to worry about side effects of applying it to all a class's > > methods.
> > namespace::autoclean is generally designed to do all this, without the > insanity of littering your codebase with crazy attributes. > > Furthermore afaict you want this functionality because you want to ... > import methods? Leaving the evilness of such an approach aside, perhaps > ou were looking for (the equally evil) Sub::Exporter::ForMethods?
Like I said, :method is a built-in part of Perl, so namespace::clean already has sufficient information upon detecting that particular crazy attribute to skip over its corresponding sub. It needn't be a central feature of namespace::clean; it would just be maximizing what it can do while keeping within the bounds of its lighter set of dependency (when compared to namespace::autoclean).
Show quoted text
> Like I said, :method is a built-in part of Perl, so namespace::clean > already has sufficient information upon detecting that particular crazy > attribute to skip over its corresponding sub. It needn't be a central > feature of namespace::clean; it would just be maximizing what it can do > while keeping within the bounds of its lighter set of dependency (when > compared to namespace::autoclean).
Currently, namespace::clean has a very simple, very specific, and well documented behaviour - it cleans everything in scope when it was imported, unless you explicitly ask it not to. You'd be welcome to either create a namespace::clean::attributeaware or similar that does what you're talking about here, or to start a new ticket proposing an explicitly turned-on feature that asks for such subs to be excluded from the cleaning process - i.e. some sort of -foo option - although I wouldn't expect any of us to write the patch to add it ourselves since :method has pretty much entirely failed to catch on so it's not relevant to any of our current real world code. Either way though, this ticket is proposing doing it automatically, which is definitely not going to happen since it would compromise the clarity of namespace::clean invocation (autoclean and other derivatives/subclasses use heuristics, namespace::clean never has); as such I'm marking it rejected.