r36536 - in /trunk/libnamespace-autoclean-perl: Changes LICENSE MANIFEST META.yml Makefile.PL README debian/changelog dist.ini lib/namespace/autoclean.pm t/matchclean.t
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Thu May 28 02:11:26 UTC 2009
Author: ryan52-guest
Date: Thu May 28 02:11:20 2009
New Revision: 36536
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36536
Log:
New upstream release
Added:
trunk/libnamespace-autoclean-perl/t/matchclean.t
- copied unchanged from r36535, branches/upstream/libnamespace-autoclean-perl/current/t/matchclean.t
Modified:
trunk/libnamespace-autoclean-perl/Changes
trunk/libnamespace-autoclean-perl/LICENSE
trunk/libnamespace-autoclean-perl/MANIFEST
trunk/libnamespace-autoclean-perl/META.yml
trunk/libnamespace-autoclean-perl/Makefile.PL
trunk/libnamespace-autoclean-perl/README
trunk/libnamespace-autoclean-perl/debian/changelog
trunk/libnamespace-autoclean-perl/dist.ini
trunk/libnamespace-autoclean-perl/lib/namespace/autoclean.pm
Modified: trunk/libnamespace-autoclean-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/Changes?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/Changes (original)
+++ trunk/libnamespace-autoclean-perl/Changes Thu May 28 02:11:20 2009
@@ -1,3 +1,7 @@
+0.07 Wed, 27 May 2009 22:27:46 +0200
+ * Drop the useless Class::MOP::class_of call (Chris Prather).
+ * Extend -also to make it accept coderefs and regexen (Kent Fredric).
+
0.06 Wed, 20 May 2009 15:14:36 +0200
* Allow selection of explicit cleanee (Shawn M Moore).
Modified: trunk/libnamespace-autoclean-perl/LICENSE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/LICENSE?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/LICENSE (original)
+++ trunk/libnamespace-autoclean-perl/LICENSE Thu May 28 02:11:20 2009
@@ -1,9 +1,9 @@
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
-the same terms as perl itself.
-
-Terms of Perl itself
+the same terms as the Perl 5 programming language system itself.
+
+Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
Modified: trunk/libnamespace-autoclean-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/MANIFEST?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/MANIFEST (original)
+++ trunk/libnamespace-autoclean-perl/MANIFEST Thu May 28 02:11:20 2009
@@ -9,4 +9,5 @@
t/also.t
t/basic.t
t/cleanee.t
+t/matchclean.t
t/role.t
Modified: trunk/libnamespace-autoclean-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/META.yml?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/META.yml (original)
+++ trunk/libnamespace-autoclean-perl/META.yml Thu May 28 02:11:20 2009
@@ -1,12 +1,16 @@
---
-abstract: Keep imports out of your namespace
+abstract: 'Keep imports out of your namespace'
author:
-- Florian Ragwitz <rafl at debian.org>
-generated_by: Dist::Zilla::Plugin::MetaYaml version 1.091260
+ - 'Florian Ragwitz <rafl at debian.org>'
+generated_by: 'Dist::Zilla::Plugin::MetaYAML version 1.091440'
license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
name: namespace-autoclean
requires:
- B::Hooks::EndOfScope: '0.07'
- Class::MOP: '0.80'
- namespace::clean: '0.11'
-version: '0.06'
+ B::Hooks::EndOfScope: 0.07
+ Class::MOP: 0.80
+ List::Util: 0
+ namespace::clean: 0.11
+version: 0.07
Modified: trunk/libnamespace-autoclean-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/Makefile.PL?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/Makefile.PL (original)
+++ trunk/libnamespace-autoclean-perl/Makefile.PL Thu May 28 02:11:20 2009
@@ -9,10 +9,11 @@
NAME => 'namespace::autoclean',
AUTHOR => 'Florian\ Ragwitz\ \<rafl\@debian\.org\>',
ABSTRACT => 'Keep imports out of your namespace',
- VERSION => '0.06',
+ VERSION => '0.07',
EXE_FILES => [ qw() ],
(eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
PREREQ_PM => {
+ "List::Util" => '0',
"namespace::clean" => '0.11',
"Class::MOP" => '0.80',
"B::Hooks::EndOfScope" => '0.07',
Modified: trunk/libnamespace-autoclean-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/README?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/README (original)
+++ trunk/libnamespace-autoclean-perl/README Thu May 28 02:11:20 2009
@@ -1,12 +1,12 @@
This archive contains the distribution namespace-autoclean, version
-0.06:
+0.07:
Keep imports out of your namespace
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
-the same terms as perl itself.
+the same terms as the Perl 5 programming language system itself.
Modified: trunk/libnamespace-autoclean-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/debian/changelog?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/debian/changelog (original)
+++ trunk/libnamespace-autoclean-perl/debian/changelog Thu May 28 02:11:20 2009
@@ -1,3 +1,9 @@
+libnamespace-autoclean-perl (0.07-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Ryan Niebur <ryanryan52 at gmail.com> Wed, 27 May 2009 19:11:10 -0700
+
libnamespace-autoclean-perl (0.06-1) unstable; urgency=low
* Initial Release. (Closes: #529242)
Modified: trunk/libnamespace-autoclean-perl/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/dist.ini?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/dist.ini (original)
+++ trunk/libnamespace-autoclean-perl/dist.ini Thu May 28 02:11:20 2009
@@ -1,5 +1,5 @@
name = namespace-autoclean
-version = 0.06
+version = 0.07
author = Florian Ragwitz <rafl at debian.org>
license = Perl_5
copyright_holder = Florian Ragwitz
@@ -8,6 +8,7 @@
namespace::clean = 0.11
B::Hooks::EndOfScope = 0.07
Class::MOP = 0.80
+List::Util = 0
[@Filter]
bundle = @Classic
Modified: trunk/libnamespace-autoclean-perl/lib/namespace/autoclean.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-autoclean-perl/lib/namespace/autoclean.pm?rev=36536&op=diff
==============================================================================
--- trunk/libnamespace-autoclean-perl/lib/namespace/autoclean.pm (original)
+++ trunk/libnamespace-autoclean-perl/lib/namespace/autoclean.pm Thu May 28 02:11:20 2009
@@ -2,28 +2,53 @@
use warnings;
package namespace::autoclean;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
# ABSTRACT: Keep imports out of your namespace
use Class::MOP;
use B::Hooks::EndOfScope;
+use List::Util qw( first );
use namespace::clean;
sub import {
my ($class, %args) = @_;
+ my $subcast = sub {
+ my $i = shift;
+ return $i if ref $i eq 'CODE';
+ return sub { $_ =~ $i } if ref $i eq 'Regexp';
+ return sub { $_ eq $i };
+ };
+
+ my $runtest = sub {
+ my ($code, $method_name) = @_;
+ local $_ = $method_name;
+ return $code->();
+ };
+
my $cleanee = exists $args{-cleanee} ? $args{-cleanee} : scalar caller;
- my @also = exists $args{-also}
+ my @also = map { $subcast->($_) } (
+ exists $args{-also}
? (ref $args{-also} eq 'ARRAY' ? @{ $args{-also} } : $args{-also})
- : ();
+ : ()
+ );
+
on_scope_end {
- my $meta = Class::MOP::class_of($cleanee) || Class::MOP::Class->initialize($cleanee);
- my %methods = map { ($_ => 1) } keys %{$meta->get_method_map};
+ my $meta = Class::MOP::Class->initialize($cleanee);
+ my %methods = map { ($_ => 1) } keys %{ $meta->get_method_map };
+ my %extra = ();
+
+ for my $method (keys %methods) {
+ next if exists $extra{$_};
+ next unless first { $runtest->($_, $method) } @also;
+ $extra{ $method } = 1;
+ }
+
my @symbols = keys %{ $meta->get_all_package_symbols('CODE') };
- namespace::clean->clean_subroutines($cleanee, @also, grep { !$methods{$_} } @symbols);
+ namespace::clean->clean_subroutines($cleanee, keys %extra, grep { !$methods{$_} } @symbols);
};
}
@@ -36,7 +61,7 @@
=head1 VERSION
-version 0.06
+version 0.07
=head1 SYNOPSIS
@@ -65,17 +90,6 @@
after you C<use>d the pagma. It will also not touch anything that looks like a
method, according to C<Class::MOP::Class::get_method_list>.
-Sometimes you don't want to clean imports only, but also helper functions
-you're using in your methods. The C<-also> switch can be used to declare a list
-of functions that should be removed additional to any imports:
-
- use namespace::autoclean -also => ['some_function', 'another_function'];
-
-If only one function needs to be additionally cleaned the C<-also> switch also
-accepts a plain string:
-
- 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:
@@ -99,7 +113,41 @@
This software is copyright (c) 2009 by Florian Ragwitz.
This is free software; you can redistribute it and/or modify it under
-the same terms as perl itself.
+the same terms as the Perl 5 programming language system itself.
+
+=head1 PARAMETERS
+
+=head2 -also => [ ITEM | REGEX | SUB, .. ]
+
+=head2 -also => ITEM
+
+=head2 -also => REGEX
+
+=head2 -also => SUB
+
+Sometimes you don't want to clean imports only, but also helper functions
+you're using in your methods. The C<-also> switch can be used to declare a list
+of functions that should be removed additional to any imports:
+
+ use namespace::autoclean -also => ['some_function', 'another_function'];
+
+If only one function needs to be additionally cleaned the C<-also> switch also
+accepts a plain string:
+
+ use namespace::autoclean -also => 'some_function';
+
+In some situations, you may wish for a more I<powerful> cleaning solution.
+
+The C<-also> switch can take a Regex or a CodeRef to match against local
+function names to clean.
+
+ use namespace::autoclean -also => qr/^_/
+
+ use namespace::autoclean -also => sub { $_ =~ m{^_} };
+
+ use namespace::autoclean -also => [qr/^_/ , qr/^hidden_/ ];
+
+ use namespace::autoclean -also => [sub { $_ =~ m/^_/ or $_ =~ m/^hidden/ }, sub { uc($_) == $_ } ];
=head1 SEE ALSO
More information about the Pkg-perl-cvs-commits
mailing list