r36005 - in /branches/upstream/libnamespace-autoclean-perl/current: Changes MANIFEST META.yml Makefile.PL README dist.ini lib/namespace/autoclean.pm t/cleanee.t
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Thu May 21 00:17:05 UTC 2009
Author: ryan52-guest
Date: Thu May 21 00:17:00 2009
New Revision: 36005
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36005
Log:
[svn-upgrade] Integrating new upstream version, libnamespace-autoclean-perl (0.06)
Added:
branches/upstream/libnamespace-autoclean-perl/current/t/cleanee.t
Modified:
branches/upstream/libnamespace-autoclean-perl/current/Changes
branches/upstream/libnamespace-autoclean-perl/current/MANIFEST
branches/upstream/libnamespace-autoclean-perl/current/META.yml
branches/upstream/libnamespace-autoclean-perl/current/Makefile.PL
branches/upstream/libnamespace-autoclean-perl/current/README
branches/upstream/libnamespace-autoclean-perl/current/dist.ini
branches/upstream/libnamespace-autoclean-perl/current/lib/namespace/autoclean.pm
Modified: branches/upstream/libnamespace-autoclean-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/Changes?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/Changes (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/Changes Thu May 21 00:17:00 2009
@@ -1,3 +1,6 @@
+0.06 Wed, 20 May 2009 15:14:36 +0200
+ * Allow selection of explicit cleanee (Shawn M Moore).
+
0.05 Fri, 01 May 2009 12:44:25 +0200
* Don't clean the 'meta' method for Moose roles, even if it's not
included in get_method_list.
Modified: branches/upstream/libnamespace-autoclean-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/MANIFEST?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/MANIFEST (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/MANIFEST Thu May 21 00:17:00 2009
@@ -8,4 +8,5 @@
lib/namespace/autoclean.pm
t/also.t
t/basic.t
+t/cleanee.t
t/role.t
Modified: branches/upstream/libnamespace-autoclean-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/META.yml?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/META.yml (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/META.yml Thu May 21 00:17:00 2009
@@ -2,11 +2,11 @@
abstract: Keep imports out of your namespace
author:
- Florian Ragwitz <rafl at debian.org>
-generated_by: Dist::Zilla::Plugin::MetaYaml version 1.007
+generated_by: Dist::Zilla::Plugin::MetaYaml version 1.091260
license: perl
name: namespace-autoclean
requires:
B::Hooks::EndOfScope: '0.07'
Class::MOP: '0.80'
namespace::clean: '0.11'
-version: '0.05'
+version: '0.06'
Modified: branches/upstream/libnamespace-autoclean-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/Makefile.PL?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/Makefile.PL (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/Makefile.PL Thu May 21 00:17:00 2009
@@ -9,7 +9,7 @@
NAME => 'namespace::autoclean',
AUTHOR => 'Florian\ Ragwitz\ \<rafl\@debian\.org\>',
ABSTRACT => 'Keep imports out of your namespace',
- VERSION => '0.05',
+ VERSION => '0.06',
EXE_FILES => [ qw() ],
(eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
PREREQ_PM => {
Modified: branches/upstream/libnamespace-autoclean-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/README?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/README (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/README Thu May 21 00:17:00 2009
@@ -1,7 +1,7 @@
This archive contains the distribution namespace-autoclean, version
-0.05:
+0.06:
Keep imports out of your namespace
Modified: branches/upstream/libnamespace-autoclean-perl/current/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/dist.ini?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/dist.ini (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/dist.ini Thu May 21 00:17:00 2009
@@ -1,5 +1,5 @@
name = namespace-autoclean
-version = 0.05
+version = 0.06
author = Florian Ragwitz <rafl at debian.org>
license = Perl_5
copyright_holder = Florian Ragwitz
Modified: branches/upstream/libnamespace-autoclean-perl/current/lib/namespace/autoclean.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/lib/namespace/autoclean.pm?rev=36005&op=diff
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/lib/namespace/autoclean.pm (original)
+++ branches/upstream/libnamespace-autoclean-perl/current/lib/namespace/autoclean.pm Thu May 21 00:17:00 2009
@@ -2,7 +2,7 @@
use warnings;
package namespace::autoclean;
-our $VERSION = '0.05';
+our $VERSION = '0.06';
# ABSTRACT: Keep imports out of your namespace
@@ -13,15 +13,17 @@
sub import {
my ($class, %args) = @_;
- my $caller = caller();
+
+ my $cleanee = exists $args{-cleanee} ? $args{-cleanee} : scalar caller;
+
my @also = exists $args{-also}
? (ref $args{-also} eq 'ARRAY' ? @{ $args{-also} } : $args{-also})
: ();
on_scope_end {
- my $meta = Class::MOP::class_of($caller) || Class::MOP::Class->initialize($caller);
+ my $meta = Class::MOP::class_of($cleanee) || Class::MOP::Class->initialize($cleanee);
my %methods = map { ($_ => 1) } keys %{$meta->get_method_map};
my @symbols = keys %{ $meta->get_all_package_symbols('CODE') };
- namespace::clean->clean_subroutines($caller, @also, grep { !$methods{$_} } @symbols);
+ namespace::clean->clean_subroutines($cleanee, @also, grep { !$methods{$_} } @symbols);
};
}
@@ -34,7 +36,7 @@
=head1 VERSION
-version 0.05
+version 0.06
=head1 SYNOPSIS
@@ -74,6 +76,20 @@
use namespace::autoclean -also => 'some_function';
+If you're writing an exporter and you want to clean up after yourself (and your
+peers), you can use the C<-cleanee> switch to specify what package to clean:
+
+ package My::MooseX::namespace::autoclean;
+ use strict;
+
+ use namespace::autocleanclean (); # no cleanup, just load
+
+ sub import {
+ namespace::autoclean->import(
+ -cleanee => scalar(caller),
+ );
+ }
+
=head1 AUTHOR
Florian Ragwitz <rafl at debian.org>
Added: branches/upstream/libnamespace-autoclean-perl/current/t/cleanee.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnamespace-autoclean-perl/current/t/cleanee.t?rev=36005&op=file
==============================================================================
--- branches/upstream/libnamespace-autoclean-perl/current/t/cleanee.t (added)
+++ branches/upstream/libnamespace-autoclean-perl/current/t/cleanee.t Thu May 21 00:17:00 2009
@@ -1,0 +1,28 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+{
+ package My::Cleaner;
+ use namespace::autoclean ();
+
+ sub import {
+ namespace::autoclean->import(
+ -cleanee => scalar(caller),
+ -also => 'blast',
+ );
+ *{Foo::boom} = sub { 'boom' };
+ }
+}
+
+{
+ package Foo;
+ BEGIN { My::Cleaner->import } # use My::Cleaner tries to load it from disk
+ sub explode { 'explode' }
+ sub blast { 'blast' }
+}
+
+ok( Foo->can('explode'), 'locally defined methods still work');
+ok(!Foo->can('boom'), 'imported functions removed');
+ok(!Foo->can('blast'), '-also methods removed');
+
More information about the Pkg-perl-cvs-commits
mailing list