New Upstream Snapshot - libnamespace-sweep-perl

Ready changes

Summary

Merged new upstream version: 0.006+git20150107.1.db90b18 (was: 0.006).

Resulting package

Built on 2023-01-19T03:13 (took 6m35s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots libnamespace-sweep-perl

Lintian Result

Diff

diff --git a/LICENSE b/LICENSE
index c4df378..e1afaf5 100644
--- a/LICENSE
+++ b/LICENSE
@@ -22,7 +22,7 @@ This is free software, licensed under:
                      Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
+ 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
@@ -292,21 +292,21 @@ Definitions:
 
   - "Package" refers to the collection of files distributed by the Copyright
     Holder, and derivatives of that collection of files created through
-    textual modification. 
+    textual modification.
   - "Standard Version" refers to such a Package if it has not been modified,
     or has been modified in accordance with the wishes of the Copyright
-    Holder. 
+    Holder.
   - "Copyright Holder" is whoever is named in the copyright or copyrights for
-    the package. 
+    the package.
   - "You" is you, if you're thinking about copying or distributing this Package.
   - "Reasonable copying fee" is whatever you can justify on the basis of media
     cost, duplication charges, time of people involved, and so on. (You will
     not be required to justify it to the Copyright Holder, but only to the
-    computing community at large as a market that must bear the fee.) 
+    computing community at large as a market that must bear the fee.)
   - "Freely Available" means that no fee is charged for the item itself, though
     there may be fees involved in handling the item. It also means that
     recipients of the item may redistribute it under the same conditions they
-    received it. 
+    received it.
 
 1. You may make and give away verbatim copies of the source form of the
 Standard Version of this Package without restriction, provided that you
@@ -373,7 +373,7 @@ products derived from this software without specific prior written permission.
 
 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
 The End
 
diff --git a/MANIFEST b/MANIFEST
index 31fa72d..04770fb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.029.
 LICENSE
 MANIFEST
 META.json
@@ -6,6 +7,7 @@ Makefile.PL
 README
 dist.ini
 lib/namespace/sweep.pm
+t/except.t
 t/ns_a_also.t
 t/ns_a_basic.t
 t/ns_a_cleanee.t
diff --git a/META.json b/META.json
index 5e6fa98..93858ae 100644
--- a/META.json
+++ b/META.json
@@ -4,26 +4,30 @@
       "Mike Friedman <friedo@friedo.com>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.300026, CPAN::Meta::Converter version 2.120921",
+   "generated_by" : "Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010",
    "license" : [
       "perl_5"
    ],
    "meta-spec" : {
       "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
-      "version" : "2"
+      "version" : 2
    },
    "name" : "namespace-sweep",
    "prereqs" : {
       "configure" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : "6.30"
+            "ExtUtils::MakeMaker" : "0"
+         }
+      },
+      "develop" : {
+         "requires" : {
+            "Test::More" : "0"
          }
       },
       "runtime" : {
          "requires" : {
             "B::Hooks::EndOfScope" : "0.09",
             "Carp" : "0",
-            "Data::Dumper" : "0",
             "List::Util" : "0",
             "Package::Stash" : "0.33",
             "Scalar::Util" : "0",
@@ -41,13 +45,9 @@
       }
    },
    "release_status" : "stable",
-   "resources" : {
-      "repository" : {
-         "type" : "git",
-         "url" : "git://github.com/friedo/perl-namespace-sweep.git",
-         "web" : "http://github.com/friedo/perl-namespace-sweep"
-      }
-   },
-   "version" : "0.006"
+   "version" : "0.006",
+   "x_generated_by_perl" : "v5.36.0",
+   "x_serialization_backend" : "Cpanel::JSON::XS version 4.32",
+   "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
 }
 
diff --git a/META.yml b/META.yml
index 19256e6..1a1acba 100644
--- a/META.yml
+++ b/META.yml
@@ -3,28 +3,28 @@ abstract: 'Sweep up imported subs in your classes'
 author:
   - 'Mike Friedman <friedo@friedo.com>'
 build_requires:
-  Sub::Name: 0
-  Test::More: 0
-  overload: 0
+  Sub::Name: '0'
+  Test::More: '0'
+  overload: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 6.30
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300026, CPAN::Meta::Converter version 2.120921'
+generated_by: 'Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: namespace-sweep
 requires:
-  B::Hooks::EndOfScope: 0.09
-  Carp: 0
-  Data::Dumper: 0
-  List::Util: 0
-  Package::Stash: 0.33
-  Scalar::Util: 0
-  Sub::Identify: 0.04
-  strict: 0
-  warnings: 0
-resources:
-  repository: git://github.com/friedo/perl-namespace-sweep.git
-version: 0.006
+  B::Hooks::EndOfScope: '0.09'
+  Carp: '0'
+  List::Util: '0'
+  Package::Stash: '0.33'
+  Scalar::Util: '0'
+  Sub::Identify: '0.04'
+  strict: '0'
+  warnings: '0'
+version: '0.006'
+x_generated_by_perl: v5.36.0
+x_serialization_backend: 'YAML::Tiny version 1.73'
+x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
diff --git a/Makefile.PL b/Makefile.PL
index 0159cc8..9efbb46 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,32 +1,23 @@
-
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.029.
 use strict;
 use warnings;
 
 
 
-use ExtUtils::MakeMaker 6.30;
-
-
+use ExtUtils::MakeMaker;
 
 my %WriteMakefileArgs = (
   "ABSTRACT" => "Sweep up imported subs in your classes",
   "AUTHOR" => "Mike Friedman <friedo\@friedo.com>",
-  "BUILD_REQUIRES" => {
-    "Sub::Name" => 0,
-    "Test::More" => 0,
-    "overload" => 0
-  },
   "CONFIGURE_REQUIRES" => {
-    "ExtUtils::MakeMaker" => "6.30"
+    "ExtUtils::MakeMaker" => 0
   },
   "DISTNAME" => "namespace-sweep",
-  "EXE_FILES" => [],
   "LICENSE" => "perl",
   "NAME" => "namespace::sweep",
   "PREREQ_PM" => {
     "B::Hooks::EndOfScope" => "0.09",
     "Carp" => 0,
-    "Data::Dumper" => 0,
     "List::Util" => 0,
     "Package::Stash" => "0.33",
     "Scalar::Util" => 0,
@@ -34,6 +25,11 @@ my %WriteMakefileArgs = (
     "strict" => 0,
     "warnings" => 0
   },
+  "TEST_REQUIRES" => {
+    "Sub::Name" => 0,
+    "Test::More" => 0,
+    "overload" => 0
+  },
   "VERSION" => "0.006",
   "test" => {
     "TESTS" => "t/*.t"
@@ -41,23 +37,28 @@ my %WriteMakefileArgs = (
 );
 
 
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
-  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
-  my $pp = $WriteMakefileArgs{PREREQ_PM};
-  for my $mod ( keys %$br ) {
-    if ( exists $pp->{$mod} ) {
-      $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
-    }
-    else {
-      $pp->{$mod} = $br->{$mod};
-    }
-  }
+my %FallbackPrereqs = (
+  "B::Hooks::EndOfScope" => "0.09",
+  "Carp" => 0,
+  "List::Util" => 0,
+  "Package::Stash" => "0.33",
+  "Scalar::Util" => 0,
+  "Sub::Identify" => "0.04",
+  "Sub::Name" => 0,
+  "Test::More" => 0,
+  "overload" => 0,
+  "strict" => 0,
+  "warnings" => 0
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+  delete $WriteMakefileArgs{TEST_REQUIRES};
+  delete $WriteMakefileArgs{BUILD_REQUIRES};
+  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
 }
 
 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
   unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
 
 WriteMakefile(%WriteMakefileArgs);
-
-
-
diff --git a/README b/README
index 5016a3d..11417f3 100644
--- a/README
+++ b/README
@@ -1,5 +1,3 @@
-
-
 This archive contains the distribution namespace-sweep,
 version 0.006:
 
@@ -11,3 +9,4 @@ This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 
+This README file was generated by Dist::Zilla::Plugin::Readme v6.029.
diff --git a/debian/changelog b/debian/changelog
index 0da892d..e428374 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libnamespace-sweep-perl (0.006+git20150107.1.db90b18-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 19 Jan 2023 03:10:36 -0000
+
 libnamespace-sweep-perl (0.006-3) unstable; urgency=medium
 
   [ Salvatore Bonaccorso ]
diff --git a/dist.ini b/dist.ini
index 96c962a..0b01f89 100644
--- a/dist.ini
+++ b/dist.ini
@@ -11,6 +11,7 @@ version = 0.006
 skip = Moo
 skip = Mouse
 skip = Moose
+skip = Moo::Role
 [TestRelease]
 [ConfirmRelease]
 [PkgVersion]
diff --git a/lib/namespace/sweep.pm b/lib/namespace/sweep.pm
index 3680992..03e9db8 100644
--- a/lib/namespace/sweep.pm
+++ b/lib/namespace/sweep.pm
@@ -1,8 +1,5 @@
 package namespace::sweep;
-{
-  $namespace::sweep::VERSION = '0.006';
-}
-
+$namespace::sweep::VERSION = '0.006';
 # ABSTRACT: Sweep up imported subs in your classes
 
 use strict;
@@ -11,7 +8,6 @@ use warnings;
 use Scalar::Util 'blessed', 'reftype';
 use List::Util 'first';
 use Carp 'croak';
-use Data::Dumper;
 
 use Sub::Identify          0.04 'get_code_info';
 use B::Hooks::EndOfScope   0.09 'on_scope_end';
@@ -23,32 +19,37 @@ sub import {
     my ( $class, %args ) = @_;
 
     my $cleanee = exists $args{-cleanee} ? $args{-cleanee} : scalar caller;
-    my @alsos;
-
-    if ( exists $args{-also} ) { 
-        if ( ref $args{-also} && ( reftype $args{-also} eq reftype [ ] ) ) { 
-            @alsos = @{ $args{-also} };
-        } else { 
-            @alsos = ( $args{-also} );
+    my %run_test = (
+        -also   => sub { +return },
+        -except => sub { +return },
+    );
+
+    foreach my $t (keys %run_test)
+    {
+        next unless exists $args{$t};
+        
+        unless ( ref $args{$t} and reftype($args{$t}) eq reftype([]) )
+        {
+            $args{$t} = [ $args{$t} ];
         }
-    }
-    
-    my @also_tests;
-    foreach my $also( @alsos ) { 
-        my $test = !$also                           ? sub { 0 }
-                 : !ref( $also )                    ? sub { $_[0] eq $also }
-                 : reftype $also eq reftype sub { } ? sub { local $_ = $_[0]; $also->() }
-                 : reftype $also eq reftype qr//    ? sub { $_[0] =~ $also }
-                 : croak sprintf q{Don't know what to do with [%s] for -also}, $also;
-
-        push @also_tests, $test;
+        
+        my @tests;
+        foreach my $arg (@{ $args{$t} }) { 
+            my $test = !$arg                           ? sub { 0 }
+                     : !ref( $arg )                    ? sub { $_[0] eq $arg }
+                     : reftype $arg eq reftype sub { } ? sub { local $_ = $_[0]; $arg->() }
+                     : reftype $arg eq reftype qr//    ? sub { $_[0] =~ $arg }
+                     : croak sprintf q{Don't know what to do with [%s] for %s}, $arg, $t;
+
+            push @tests, $test;
+        }
+        
+        $run_test{$t} = sub { 
+            return 1 if first { $_->( $_[0] ) } @tests;
+            return;
+        };
     }
 
-    my $run_test = sub { 
-        return 1 if first { $_->( $_[0] ) } @also_tests;
-        return;
-    };
-
     on_scope_end { 
         no strict 'refs';
         my $st = $cleanee . '::';
@@ -82,7 +83,8 @@ sub import {
         }
 
         foreach my $sym( keys %{ $st } ) { 
-            $sweep->( $sym ) and next if $run_test->( $sym );
+            next if $run_test{-except}->( $sym );
+            $sweep->( $sym ) and next if $run_test{-also}->( $sym );
 
             next unless exists &{ $st . $sym };
             next if $keep{$sym};
@@ -103,6 +105,8 @@ __END__
 
 =pod
 
+=encoding utf-8
+
 =head1 NAME
 
 namespace::sweep - Sweep up imported subs in your classes
@@ -113,20 +117,20 @@ version 0.006
 
 =head1 SYNOPSIS
 
-    package Foo;
-
-    use namespace::sweep;
-    use Some::Module qw(some_function);
-
-    sub my_method { 
-         my $foo = some_function();
-         ...
-    }
-
-    package main;
-
-    Foo->my_method;      # ok
-    Foo->some_function;  # ERROR!
+ package Foo;
+ 
+ use namespace::sweep;
+ use Some::Module qw(some_function);
+ 
+ sub my_method { 
+      my $foo = some_function();
+      ...
+ }
+ 
+ package main;
+ 
+ Foo->my_method;      # ok
+ Foo->some_function;  # ERROR!
 
 =head1 DESCRIPTION
 
@@ -137,8 +141,6 @@ symbol table, thereby ensuring that your interface is as you specified it. Howev
 code inside your module will still be able to use the imported functions without any 
 problems.
 
-=encoding utf-8
-
 =head1 ARGUMENTS
 
 The following arguments may be passed on the C<use> line:
@@ -150,8 +152,8 @@ The following arguments may be passed on the C<use> line:
 If you want to clean a different class than the one importing this pragma, you can 
 specify it with this flag. Otherwise, the importing class is assumed.
 
-    package Foo;
-    use namespace::sweep -cleanee => 'Bar'   # sweep up Bar.pm
+ package Foo;
+ use namespace::sweep -cleanee => 'Bar'   # sweep up Bar.pm
 
 =item -also
 
@@ -159,20 +161,40 @@ This lets you provide a mechanism to specify other subs to sweep up that would n
 normally be caught. (For example, private helper subs in your module's class that
 should not be called as methods.)
 
-    package Foo;
-    use namespace::sweep -also => '_helper';          # sweep up single sub
-    use namespace::sweep -also => [qw/foo bar baz/];  # list of subs
-    use namespace::sweep -also => qr/^secret_/;       # subs matching regex
+ package Foo;
+ use namespace::sweep -also => '_helper';         # sweep single sub
+ use namespace::sweep -also => [qw/foo bar baz/]; # list of subs
+ use namespace::sweep -also => qr/^secret_/;      # matching regex
 
 You can also specify a subroutine reference which will receive the symbol name as
 C<$_>. If the sub returns true, the symbol will be swept.
 
-    # sweep up those rude four-letter subs
-    use namespace::sweep -also => sub { return 1 if length $_ == 4 }
+ # sweep up those rude four-letter subs
+ use namespace::sweep -also => sub { return 1 if length $_ == 4 }
 
 You can also combine these methods into an array reference:
 
-    use namespace::sweep -also => [ 'string', sub { 1 if /$pat/ and $_ !~ /$other/ }, qr/^foo_.+/ ];
+ use namespace::sweep -also => [
+     'string',
+     sub { 1 if /$pat/ and $_ !~ /$other/ },
+     qr/^foo_.+/,
+ ];
+
+=item -except
+
+This lets you specify subroutines which should be kept despite eveything else.
+For example, if you use L<Exporter> or L<Sub::Exporter>, you probably want to
+keep the C<import> method installed into your package:
+
+ package Foo;
+ use Exporter 'import';
+ use namespace::sweep -except => 'import';
+
+If using sub attributes, then you may need to keep certain special subs:
+
+ use namespace::sweep -except => qr{^(FETCH|MODIFY)_\w+_ATTRIBUTES$};
+
+When a sub matches both C<< -also >> and C<< -except >>, then C<< -except >> "wins".
 
 =back
 
diff --git a/t/except.t b/t/except.t
new file mode 100644
index 0000000..c42fc98
--- /dev/null
+++ b/t/except.t
@@ -0,0 +1,45 @@
+use Test::More tests => 4;
+
+BEGIN {
+    package Local::Clean;
+    use Scalar::Util qw( blessed reftype );
+    use namespace::sweep;
+};
+
+BEGIN {
+    package Local::Dirty;
+    use Scalar::Util qw( blessed reftype );
+    use namespace::sweep -except => 'blessed';
+};
+
+BEGIN {
+    package Local::Filthy;
+    use Scalar::Util qw( blessed reftype );
+    use namespace::sweep -except => [ qr{e} ];
+};
+
+BEGIN {
+    package Local::Conflicting;
+    sub foo { 1 };
+    use namespace::sweep -also => 'foo', -except => 'foo';
+};
+
+ok(
+    !Local::Clean->can('blessed') && !Local::Clean->can('reftype'),
+    'default'
+);
+
+ok(
+    Local::Dirty->can('blessed') && !Local::Dirty->can('reftype'),
+    '-except "subname"'
+);
+
+ok(
+    Local::Filthy->can('blessed') && Local::Filthy->can('reftype'),
+    '-except qr{regex}'
+);
+
+ok(
+    Local::Conflicting->can('foo'),
+    '-except beats -also'
+);
diff --git a/t/x-moo.t b/t/x-moo.t
index 258cc09..d64bcfa 100644
--- a/t/x-moo.t
+++ b/t/x-moo.t
@@ -5,12 +5,30 @@ BEGIN {
 		or plan skip_all => 'This test requires Moo'
 }
 
-{
+BEGIN {
+	package Local::Noisy;
+	use Moo::Role;
+	requires 'noise';
+	sub loud_noise { uc(shift->noise) };
+};
+
+BEGIN {
 	package Local::Cow;
 	use Moo;
 	use namespace::sweep;
-}
+	sub noise { 'moo' };
+	with qw( Local::Noisy );
+};
 
-can_ok 'Local::Cow' => qw( new );
 ok not $INC{'Moose.pm'};
+
+can_ok 'Local::Cow' => qw( new );
+can_ok 'Local::Cow' => qw( noise );
+can_ok 'Local::Cow' => qw( loud_noise );
+
+is(
+	'Local::Cow'->new->loud_noise,
+	'MOO',
+);
+
 done_testing;

Debdiff

File lists identical (after any substitutions)

No differences were encountered in the control files

More details

Full run details