r58932 - in /trunk/libnamespace-clean-perl: ./ debian/ inc/ lib/namespace/ t/ t_author/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sun Jun 6 05:09:48 UTC 2010


Author: ansgar-guest
Date: Sun Jun  6 05:09:40 2010
New Revision: 58932

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=58932
Log:
WAITS-FOR: libpackage-stash-perl 0.03-1
* New upstream release.
* Add (build-)dep on libpackage-stash-perl.
* Add myself to Uploaders.

Added:
    trunk/libnamespace-clean-perl/LICENSE
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/LICENSE
    trunk/libnamespace-clean-perl/META.json
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/META.json
    trunk/libnamespace-clean-perl/dist.ini
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/dist.ini
    trunk/libnamespace-clean-perl/t/author-07-debugger.t
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/t/author-07-debugger.t
    trunk/libnamespace-clean-perl/t/release-eol.t
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/t/release-eol.t
    trunk/libnamespace-clean-perl/t/release-no-tabs.t
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/t/release-no-tabs.t
    trunk/libnamespace-clean-perl/t/release-pod-coverage.t
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/t/release-pod-coverage.t
    trunk/libnamespace-clean-perl/t/release-pod-syntax.t
      - copied unchanged from r58926, branches/upstream/libnamespace-clean-perl/current/t/release-pod-syntax.t
Removed:
    trunk/libnamespace-clean-perl/inc/
    trunk/libnamespace-clean-perl/t_author/
Modified:
    trunk/libnamespace-clean-perl/Changes
    trunk/libnamespace-clean-perl/MANIFEST
    trunk/libnamespace-clean-perl/META.yml
    trunk/libnamespace-clean-perl/Makefile.PL
    trunk/libnamespace-clean-perl/README
    trunk/libnamespace-clean-perl/debian/changelog
    trunk/libnamespace-clean-perl/debian/control
    trunk/libnamespace-clean-perl/lib/namespace/clean.pm
    trunk/libnamespace-clean-perl/t/00-basic.t
    trunk/libnamespace-clean-perl/t/02-inheritance.t
    trunk/libnamespace-clean-perl/t/08-const-sub.t

Modified: trunk/libnamespace-clean-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/Changes?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/Changes (original)
+++ trunk/libnamespace-clean-perl/Changes Sun Jun  6 05:09:40 2010
@@ -1,3 +1,14 @@
+    [0.17]
+        - Make sure the debugger author test is skipped for
+          non-authors before the debugger is even loaded.
+
+    [0.16]
+        - Release all changes of 0.15 as part of a stable release.
+        - Convert from Module::Install to Dist::Zilla.
+
+    [0.15] TRIAL release
+        - Use Package::Stash for the stash manipulation bits (doy).
+
     [0.14] Thu Mar 18 11:15:38 CET 2010
         - Disable auto_install.
         - Turn the error prone debugger test into an author test.

Modified: trunk/libnamespace-clean-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/MANIFEST?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/MANIFEST (original)
+++ trunk/libnamespace-clean-perl/MANIFEST Sun Jun  6 05:09:40 2010
@@ -1,17 +1,12 @@
 Changes
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
+LICENSE
+MANIFEST
+META.json
+META.yml
+Makefile.PL
+README
+dist.ini
 lib/namespace/clean.pm
-Makefile.PL
-MANIFEST			This list of files
-META.yml
-README
 t/00-basic.t
 t/01-function-wipeout.t
 t/02-inheritance.t
@@ -20,6 +15,7 @@
 t/05-explicit-cleanee.t
 t/06-other-types.t
 t/08-const-sub.t
+t/author-07-debugger.t
 t/lib/CleaneeBridge.pm
 t/lib/CleaneeBridgeDirect.pm
 t/lib/CleaneeBridgeExplicit.pm
@@ -29,6 +25,7 @@
 t/lib/Inheritance.pm
 t/lib/OtherTypes.pm
 t/lib/Unimport.pm
-t_author/07-debugger.t
-t_author/10-pod.t
-t_author/11-pod-coverage.t
+t/release-eol.t
+t/release-no-tabs.t
+t/release-pod-coverage.t
+t/release-pod-syntax.t

Modified: trunk/libnamespace-clean-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/META.yml?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/META.yml (original)
+++ trunk/libnamespace-clean-perl/META.yml Sun Jun  6 05:09:40 2010
@@ -2,32 +2,154 @@
 abstract: 'Keep imports and functions out of your namespace'
 author:
   - "Robert 'phaylon' Sedlacek <rs at 474.at>"
+  - 'Florian Ragwitz <rafl at debian.org>'
+  - 'Jesse Luehrs <doy at tozt.net>'
 build_requires:
-  ExtUtils::MakeMaker: 6.42
+  Exporter: 0
   FindBin: 0
   Test::More: 0.88
+  constant: 0
 configure_requires:
-  ExtUtils::MakeMaker: 6.42
-distribution_type: module
-generated_by: 'Module::Install version 0.95'
+  ExtUtils::MakeMaker: 6.31
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.101550, CPAN::Meta::Converter version 2.101461'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   version: 1.4
 name: namespace-clean
-no_index:
-  directory:
-    - inc
-    - t
-provides:
-  namespace::clean:
-    file: lib/namespace/clean.pm
-    version: 0.14
 requires:
   B::Hooks::EndOfScope: 0.07
+  Package::Stash: 0.03
   Sub::Identify: 0.04
   Sub::Name: 0.04
-  Symbol: 0
+  vars: 0
 resources:
-  license: http://dev.perl.org/licenses/
-version: 0.14
+  bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean
+  homepage: http://search.cpan.org/dist/namespace-clean
+  repository: git://github.com/rafl/namespace-clean.git
+version: 0.17
+x_Dist_Zilla:
+  plugins:
+    -
+      class: Dist::Zilla::Plugin::GatherDir
+      name: '@FLORA/@Basic/GatherDir'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::PruneCruft
+      name: '@FLORA/@Basic/PruneCruft'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::ManifestSkip
+      name: '@FLORA/@Basic/ManifestSkip'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::MetaYAML
+      name: '@FLORA/@Basic/MetaYAML'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::License
+      name: '@FLORA/@Basic/License'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::Readme
+      name: '@FLORA/@Basic/Readme'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::ExtraTests
+      name: '@FLORA/@Basic/ExtraTests'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::ExecDir
+      name: '@FLORA/@Basic/ExecDir'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::ShareDir
+      name: '@FLORA/@Basic/ShareDir'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::MakeMaker
+      name: '@FLORA/@Basic/MakeMaker'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::Manifest
+      name: '@FLORA/@Basic/Manifest'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::TestRelease
+      name: '@FLORA/@Basic/TestRelease'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::ConfirmRelease
+      name: '@FLORA/@Basic/ConfirmRelease'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::UploadToCPAN
+      name: '@FLORA/@Basic/UploadToCPAN'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::MetaConfig
+      name: '@FLORA/MetaConfig'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::MetaJSON
+      name: '@FLORA/MetaJSON'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::PkgVersion
+      name: '@FLORA/PkgVersion'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::PodSyntaxTests
+      name: '@FLORA/PodSyntaxTests'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::NoTabsTests
+      name: '@FLORA/NoTabsTests'
+      version: 0.01
+    -
+      class: Dist::Zilla::Plugin::PodCoverageTests
+      name: '@FLORA/PodCoverageTests'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::MetaResources
+      name: '@FLORA/MetaResources'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::Authority
+      name: '@FLORA/Authority'
+      version: 1.000
+    -
+      class: Dist::Zilla::Plugin::EOLTests
+      name: '@FLORA/EOLTests'
+      version: 0.02
+    -
+      class: Dist::Zilla::Plugin::PodWeaver
+      name: '@FLORA/PodWeaver'
+      version: 3.101530
+    -
+      class: Dist::Zilla::Plugin::AutoPrereq
+      name: AutoPrereq
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::FinderCode
+      name: ':InstallModules'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::FinderCode
+      name: ':TestFiles'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::FinderCode
+      name: ':ExecFiles'
+      version: 4.101550
+    -
+      class: Dist::Zilla::Plugin::FinderCode
+      name: ':ShareFiles'
+      version: 4.101550
+  zilla:
+    class: Dist::Zilla
+    config:
+      is_trial: 0
+    version: 4.101550
+x_authority: cpan:PHAYLON

Modified: trunk/libnamespace-clean-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/Makefile.PL?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/Makefile.PL (original)
+++ trunk/libnamespace-clean-perl/Makefile.PL Sun Jun  6 05:09:40 2010
@@ -1,31 +1,60 @@
-#!/usr/bin/env perl
+
+use strict;
 use warnings;
-use strict;
 
-use inc::Module::Install;
 
-name            q{namespace-clean};
-license         q{perl};
-author          q{Robert 'phaylon' Sedlacek <rs at 474.at>};
-all_from        q{lib/namespace/clean.pm};
 
-build_requires  q{Test::More},                  '0.88';
-build_requires  q{FindBin},                     0;
+use ExtUtils::MakeMaker 6.31;
 
-requires        q{B::Hooks::EndOfScope},        '0.07';
-requires        q{Symbol},                      0;
-requires        q{Sub::Name},                   '0.04';
-requires        q{Sub::Identify},               '0.04';
 
-auto_provides;
 
-if (-e 'MANIFEST.SKIP') {
+my %WriteMakefileArgs = (
+  'ABSTRACT' => 'Keep imports and functions out of your namespace',
+  'AUTHOR' => 'Robert \'phaylon\' Sedlacek <rs at 474.at>, Florian Ragwitz <rafl at debian.org>, Jesse Luehrs <doy at tozt.net>',
+  'BUILD_REQUIRES' => {
+    'Exporter' => '0',
+    'FindBin' => '0',
+    'Test::More' => '0.88',
+    'constant' => '0'
+  },
+  'CONFIGURE_REQUIRES' => {
+    'ExtUtils::MakeMaker' => '6.31'
+  },
+  'DISTNAME' => 'namespace-clean',
+  'EXE_FILES' => [],
+  'LICENSE' => 'perl',
+  'NAME' => 'namespace::clean',
+  'PREREQ_PM' => {
+    'B::Hooks::EndOfScope' => '0.07',
+    'Package::Stash' => '0.03',
+    'Sub::Identify' => '0.04',
+    'Sub::Name' => '0.04',
+    'vars' => '0'
+  },
+  'VERSION' => '0.17',
+  'test' => {
+    'TESTS' => 't/*.t'
+  }
+);
 
-    print "Creating README file\n";
-    system 'pod2text lib/namespace/clean.pm > README';
 
-    print "Adding author tests to 'make test' run\n";
-    tests 't/*.t t_author/*.t';
+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};
+    }
+  }
 }
 
-WriteAll;
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+

Modified: trunk/libnamespace-clean-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/README?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/README (original)
+++ trunk/libnamespace-clean-perl/README Sun Jun  6 05:09:40 2010
@@ -1,180 +1,13 @@
-NAME
-    namespace::clean - Keep imports and functions out of your namespace
 
-VERSION
-    0.13
 
-SYNOPSIS
-      package Foo;
-      use warnings;
-      use strict;
+This archive contains the distribution namespace-clean,
+version 0.17:
 
-      use Carp qw(croak);   # 'croak' will be removed
+  Keep imports and functions out of your namespace
 
-      sub bar { 23 }        # 'bar' will be removed
+This software is copyright (c) 2010 by Robert 'phaylon' Sedlacek.
 
-      # remove all previously defined functions
-      use namespace::clean;
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
 
-      sub baz { bar() }     # 'baz' still defined, 'bar' still bound
 
-      # begin to collection function names from here again
-      no namespace::clean;
-
-      sub quux { baz() }    # 'quux' will be removed
-
-      # remove all functions defined after the 'no' unimport
-      use namespace::clean;
-
-      # Will print: 'No', 'No', 'Yes' and 'No'
-      print +(__PACKAGE__->can('croak') ? 'Yes' : 'No'), "\n";
-      print +(__PACKAGE__->can('bar')   ? 'Yes' : 'No'), "\n";
-      print +(__PACKAGE__->can('baz')   ? 'Yes' : 'No'), "\n";
-      print +(__PACKAGE__->can('quux')  ? 'Yes' : 'No'), "\n";
-
-      1;
-
-DESCRIPTION
-  Keeping packages clean
-    When you define a function, or import one, into a Perl package, it will
-    naturally also be available as a method. This does not per se cause
-    problems, but it can complicate subclassing and, for example, plugin
-    classes that are included via multiple inheritance by loading them as
-    base classes.
-
-    The "namespace::clean" pragma will remove all previously declared or
-    imported symbols at the end of the current package's compile cycle.
-    Functions called in the package itself will still be bound by their
-    name, but they won't show up as methods on your class or instances.
-
-    By unimporting via "no" you can tell "namespace::clean" to start
-    collecting functions for the next "use namespace::clean;" specification.
-
-    You can use the "-except" flag to tell "namespace::clean" that you don't
-    want it to remove a certain function or method. A common use would be a
-    module exporting an "import" method along with some functions:
-
-      use ModuleExportingImport;
-      use namespace::clean -except => [qw( import )];
-
-    If you just want to "-except" a single sub, you can pass it directly.
-    For more than one value you have to use an array reference.
-
-  Explicitely removing functions when your scope is compiled
-    It is also possible to explicitely tell "namespace::clean" what packages
-    to remove when the surrounding scope has finished compiling. Here is an
-    example:
-
-      package Foo;
-      use strict;
-
-      # blessed NOT available
-
-      sub my_class {
-          use Scalar::Util qw( blessed );
-          use namespace::clean qw( blessed );
-
-          # blessed available
-          return blessed shift;
-      }
-
-      # blessed NOT available
-
-  Moose
-    When using "namespace::clean" together with Moose you want to keep the
-    installed "meta" method. So your classes should look like:
-
-      package Foo;
-      use Moose;
-      use namespace::clean -except => 'meta';
-      ...
-
-    Same goes for Moose::Role.
-
-  Cleaning other packages
-    You can tell "namespace::clean" that you want to clean up another
-    package instead of the one importing. To do this you have to pass in the
-    "-cleanee" option like this:
-
-      package My::MooseX::namespace::clean;
-      use strict;
-
-      use namespace::clean (); # no cleanup, just load
-
-      sub import {
-          namespace::clean->import(
-            -cleanee => scalar(caller),
-            -except  => 'meta',
-          );
-      }
-
-    If you don't care about "namespace::clean"s discover-and-"-except"
-    logic, and just want to remove subroutines, try "clean_subroutines".
-
-METHODS
-    You shouldn't need to call any of these. Just "use" the package at the
-    appropriate place.
-
-  clean_subroutines
-    This exposes the actual subroutine-removal logic.
-
-      namespace::clean->clean_subroutines($cleanee, qw( subA subB ));
-
-    will remove "subA" and "subB" from $cleanee. Note that this will remove
-    the subroutines immediately and not wait for scope end. If you want to
-    have this effect at a specific time (e.g. "namespace::clean" acts on
-    scope compile end) it is your responsibility to make sure it runs at
-    that time.
-
-  import
-    Makes a snapshot of the current defined functions and installs a
-    B::Hooks::EndOfScope hook in the current scope to invoke the cleanups.
-
-  unimport
-    This method will be called when you do a
-
-      no namespace::clean;
-
-    It will start a new section of code that defines functions to clean up.
-
-  get_class_store
-    This returns a reference to a hash in a passed package containing
-    information about function names included and excluded from removal.
-
-  get_functions
-    Takes a class as argument and returns all currently defined functions in
-    it as a hash reference with the function name as key and a typeglob
-    reference to the symbol as value.
-
-BUGS
-    "namespace::clean" will clobber any formats that have the same name as a
-    deleted sub. This is due to a bug in perl that makes it impossible to
-    re-assign the FORMAT ref into a new glob.
-
-IMPLEMENTATION DETAILS
-    This module works through the effect that a
-
-      delete $SomePackage::{foo};
-
-    will remove the "foo" symbol from $SomePackage for run time lookups
-    (e.g., method calls) but will leave the entry alive to be called by
-    already resolved names in the package itself. "namespace::clean" will
-    restore and therefor in effect keep all glob slots that aren't "CODE".
-
-    A test file has been added to the perl core to ensure that this
-    behaviour will be stable in future releases.
-
-    Just for completeness sake, if you want to remove the symbol completely,
-    use "undef" instead.
-
-SEE ALSO
-    B::Hooks::EndOfScope
-
-AUTHOR AND COPYRIGHT
-    Robert 'phaylon' Sedlacek "<rs at 474.at>", with many thanks to Matt S
-    Trout for the inspiration on the whole idea.
-
-LICENSE
-    This program is free software; you can redistribute it and/or modify it
-    under the same terms as perl itself.
-

Modified: trunk/libnamespace-clean-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/debian/changelog?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/debian/changelog (original)
+++ trunk/libnamespace-clean-perl/debian/changelog Sun Jun  6 05:09:40 2010
@@ -1,3 +1,13 @@
+libnamespace-clean-perl (0.17-1) UNRELEASED; urgency=low
+
+  WAITS-FOR: libpackage-stash-perl 0.03-1
+
+  * New upstream release.
+  * Add (build-)dep on libpackage-stash-perl.
+  * Add myself to Uploaders.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sun, 06 Jun 2010 13:46:13 +0900
+
 libnamespace-clean-perl (0.14-1) unstable; urgency=low
 
   [ Jonathan Yu ]

Modified: trunk/libnamespace-clean-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/debian/control?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/debian/control (original)
+++ trunk/libnamespace-clean-perl/debian/control Sun Jun  6 05:09:40 2010
@@ -4,11 +4,12 @@
 Build-Depends: debhelper (>= 7)
 Build-Depends-Indep: perl, libb-hooks-endofscope-perl,
  libsub-name-perl (>= 0.04), libsub-identify-perl (>= 0.04),
- perl (>= 5.10.1) | libtest-simple-perl (>= 0.88)
+ perl (>= 5.10.1) | libtest-simple-perl (>= 0.88),
+ libpackage-stash-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Damyan Ivanov <dmn at debian.org>, Jonathan Yu <jawnsy at cpan.org>,
  Rene Mayorga <rmayorga at debian.org.sv>, gregor herrmann <gregoa at debian.org>,
- Antonio Radici <antonio at dyne.org>
+ Antonio Radici <antonio at dyne.org>, Ansgar Burchardt <ansgar at 43-1.org>
 Standards-Version: 3.8.4
 Homepage: http://search.cpan.org/dist/namespace-clean/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnamespace-clean-perl/
@@ -17,7 +18,8 @@
 Package: libnamespace-clean-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, libb-hooks-endofscope-perl,
- libsub-name-perl (>= 0.04), libsub-identify-perl (>= 0.04)
+ libsub-name-perl (>= 0.04), libsub-identify-perl (>= 0.04),
+ libpackage-stash-perl
 Description: module for keeping imports and functions out of the current namespace
  namespace::clean is a Perl pragma for keeping imported functions out of the
  current namespace. This is especially important because Perl functions are

Modified: trunk/libnamespace-clean-perl/lib/namespace/clean.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/lib/namespace/clean.pm?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/lib/namespace/clean.pm (original)
+++ trunk/libnamespace-clean-perl/lib/namespace/clean.pm Sun Jun  6 05:09:40 2010
@@ -1,28 +1,169 @@
 package namespace::clean;
-
-=head1 NAME
-
-namespace::clean - Keep imports and functions out of your namespace
-
-=cut
+BEGIN {
+  $namespace::clean::AUTHORITY = 'cpan:PHAYLON';
+}
+BEGIN {
+  $namespace::clean::VERSION = '0.17';
+}
+# ABSTRACT: Keep imports and functions out of your namespace
 
 use warnings;
 use strict;
 
-use vars        qw( $VERSION $STORAGE_VAR $SCOPE_HOOK_KEY $SCOPE_EXPLICIT );
-use Symbol      qw( qualify_to_ref gensym );
-use B::Hooks::EndOfScope;
-use Sub::Identify qw(sub_fullname);
-use Sub::Name qw(subname);
-
-=head1 VERSION
-
-0.13
-
-=cut
-
-$VERSION         = '0.14';
-$STORAGE_VAR     = '__NAMESPACE_CLEAN_STORAGE';
+use vars qw( $STORAGE_VAR );
+use Sub::Name 0.04 qw(subname);
+use Sub::Identify 0.04 qw(sub_fullname);
+use Package::Stash 0.03;
+use B::Hooks::EndOfScope 0.07;
+
+$STORAGE_VAR = '__NAMESPACE_CLEAN_STORAGE';
+
+
+my $RemoveSubs = sub {
+
+    my $cleanee = shift;
+    my $store   = shift;
+    my $cleanee_stash = Package::Stash->new($cleanee);
+    my $deleted_stash = Package::Stash->new("namespace::clean::deleted::$cleanee");
+  SYMBOL:
+    for my $f (@_) {
+        my $variable = "&$f";
+        # ignore already removed symbols
+        next SYMBOL if $store->{exclude}{ $f };
+
+        next SYMBOL unless $cleanee_stash->has_package_symbol($variable);
+
+        if (ref(\$cleanee_stash->namespace->{$f}) eq 'GLOB') {
+            # convince the Perl debugger to work
+            # it assumes that sub_fullname($sub) can always be used to find the CV again
+            # since we are deleting the glob where the subroutine was originally
+            # defined, that assumption no longer holds, so we need to move it
+            # elsewhere and point the CV's name to the new glob.
+            my $sub = $cleanee_stash->get_package_symbol($variable);
+            if ( sub_fullname($sub) eq ($cleanee_stash->name . "::$f") ) {
+                my $new_fq = $deleted_stash->name . "::$f";
+                subname($new_fq, $sub);
+                $deleted_stash->add_package_symbol($variable, $sub);
+            }
+        }
+
+        $cleanee_stash->remove_package_symbol($variable);
+    }
+};
+
+sub clean_subroutines {
+    my ($nc, $cleanee, @subs) = @_;
+    $RemoveSubs->($cleanee, {}, @subs);
+}
+
+
+sub import {
+    my ($pragma, @args) = @_;
+
+    my (%args, $is_explicit);
+
+  ARG:
+    while (@args) {
+
+        if ($args[0] =~ /^\-/) {
+            my $key = shift @args;
+            my $value = shift @args;
+            $args{ $key } = $value;
+        }
+        else {
+            $is_explicit++;
+            last ARG;
+        }
+    }
+
+    my $cleanee = exists $args{ -cleanee } ? $args{ -cleanee } : scalar caller;
+    if ($is_explicit) {
+        on_scope_end {
+            $RemoveSubs->($cleanee, {}, @args);
+        };
+    }
+    else {
+
+        # calling class, all current functions and our storage
+        my $functions = $pragma->get_functions($cleanee);
+        my $store     = $pragma->get_class_store($cleanee);
+        my $stash     = Package::Stash->new($cleanee);
+
+        # except parameter can be array ref or single value
+        my %except = map {( $_ => 1 )} (
+            $args{ -except }
+            ? ( ref $args{ -except } eq 'ARRAY' ? @{ $args{ -except } } : $args{ -except } )
+            : ()
+        );
+
+        # register symbols for removal, if they have a CODE entry
+        for my $f (keys %$functions) {
+            next if     $except{ $f };
+            next unless $stash->has_package_symbol("&$f");
+            $store->{remove}{ $f } = 1;
+        }
+
+        # register EOF handler on first call to import
+        unless ($store->{handler_is_installed}) {
+            on_scope_end {
+                $RemoveSubs->($cleanee, $store, keys %{ $store->{remove} });
+            };
+            $store->{handler_is_installed} = 1;
+        }
+
+        return 1;
+    }
+}
+
+
+sub unimport {
+    my ($pragma, %args) = @_;
+
+    # the calling class, the current functions and our storage
+    my $cleanee   = exists $args{ -cleanee } ? $args{ -cleanee } : scalar caller;
+    my $functions = $pragma->get_functions($cleanee);
+    my $store     = $pragma->get_class_store($cleanee);
+
+    # register all unknown previous functions as excluded
+    for my $f (keys %$functions) {
+        next if $store->{remove}{ $f }
+             or $store->{exclude}{ $f };
+        $store->{exclude}{ $f } = 1;
+    }
+
+    return 1;
+}
+
+
+sub get_class_store {
+    my ($pragma, $class) = @_;
+    my $stash = Package::Stash->new($class);
+    return $stash->get_package_symbol("%$STORAGE_VAR");
+}
+
+
+sub get_functions {
+    my ($pragma, $class) = @_;
+
+    my $stash = Package::Stash->new($class);
+    return {
+        map { $_ => $stash->get_package_symbol("&$_") }
+            $stash->list_all_package_symbols('CODE')
+    };
+}
+
+
+no warnings;
+'Danger! Laws of Thermodynamics may not apply.'
+
+__END__
+=pod
+
+=encoding utf-8
+
+=head1 NAME
+
+namespace::clean - Keep imports and functions out of your namespace
 
 =head1 SYNOPSIS
 
@@ -62,7 +203,7 @@
 When you define a function, or import one, into a Perl package, it will
 naturally also be available as a method. This does not per se cause
 problems, but it can complicate subclassing and, for example, plugin
-classes that are included via multiple inheritance by loading them as 
+classes that are included via multiple inheritance by loading them as
 base classes.
 
 The C<namespace::clean> pragma will remove all previously declared or
@@ -139,11 +280,6 @@
 
 =head1 METHODS
 
-You shouldn't need to call any of these. Just C<use> the package at the
-appropriate place.
-
-=cut
-
 =head2 clean_subroutines
 
 This exposes the actual subroutine-removal logic.
@@ -155,131 +291,11 @@
 effect at a specific time (e.g. C<namespace::clean> acts on scope compile end)
 it is your responsibility to make sure it runs at that time.
 
-=cut
-
-my $RemoveSubs = sub {
-
-    my $cleanee = shift;
-    my $store   = shift;
-  SYMBOL:
-    for my $f (@_) {
-        my $fq = "${cleanee}::$f";
-
-        # ignore already removed symbols
-        next SYMBOL if $store->{exclude}{ $f };
-        no strict 'refs';
-
-        next SYMBOL unless exists ${ "${cleanee}::" }{ $f };
-
-        if (ref(\${ "${cleanee}::" }{ $f }) eq 'GLOB') {
-            # convince the Perl debugger to work
-            # it assumes that sub_fullname($sub) can always be used to find the CV again
-            # since we are deleting the glob where the subroutine was originally
-            # defined, that assumption no longer holds, so we need to move it
-            # elsewhere and point the CV's name to the new glob.
-            my $sub = \&$fq;
-            if ( sub_fullname($sub) eq $fq ) {
-                my $new_fq = "namespace::clean::deleted::$fq";
-                subname($new_fq, $sub);
-                *{$new_fq} = $sub;
-            }
-
-            local *__tmp;
-
-            # keep original value to restore non-code slots
-            {   no warnings 'uninitialized';    # fix possible unimports
-                *__tmp = *{ ${ "${cleanee}::" }{ $f } };
-                delete ${ "${cleanee}::" }{ $f };
-            }
-
-          SLOT:
-            # restore non-code slots to symbol.
-            # omit the FORMAT slot, since perl erroneously puts it into the
-            # SCALAR slot of the new glob.
-            for my $t (qw( SCALAR ARRAY HASH IO )) {
-                next SLOT unless defined *__tmp{ $t };
-                *{ "${cleanee}::$f" } = *__tmp{ $t };
-            }
-        }
-        else {
-            # A non-glob in the stash is assumed to stand for some kind
-            # of function.  So far they all do, but the core might change
-            # this some day.  Watch perl5-porters.
-            delete ${ "${cleanee}::" }{ $f };
-        }
-    }
-};
-
-sub clean_subroutines {
-    my ($nc, $cleanee, @subs) = @_;
-    $RemoveSubs->($cleanee, {}, @subs);
-}
-
 =head2 import
 
 Makes a snapshot of the current defined functions and installs a
 L<B::Hooks::EndOfScope> hook in the current scope to invoke the cleanups.
 
-=cut
-
-sub import {
-    my ($pragma, @args) = @_;
-
-    my (%args, $is_explicit);
-
-  ARG:
-    while (@args) {
-
-        if ($args[0] =~ /^\-/) {
-            my $key = shift @args;
-            my $value = shift @args;
-            $args{ $key } = $value;
-        }
-        else {
-            $is_explicit++;
-            last ARG;
-        }
-    }
-
-    my $cleanee = exists $args{ -cleanee } ? $args{ -cleanee } : scalar caller;
-    if ($is_explicit) {
-        on_scope_end {
-            $RemoveSubs->($cleanee, {}, @args);
-        };
-    }
-    else {
-
-        # calling class, all current functions and our storage
-        my $functions = $pragma->get_functions($cleanee);
-        my $store     = $pragma->get_class_store($cleanee);
-
-        # except parameter can be array ref or single value
-        my %except = map {( $_ => 1 )} (
-            $args{ -except }
-            ? ( ref $args{ -except } eq 'ARRAY' ? @{ $args{ -except } } : $args{ -except } )
-            : ()
-        );
-
-        # register symbols for removal, if they have a CODE entry
-        for my $f (keys %$functions) {
-            next if     $except{ $f };
-            next unless    $functions->{ $f } 
-                    and *{ $functions->{ $f } }{CODE};
-            $store->{remove}{ $f } = 1;
-        }
-
-        # register EOF handler on first call to import
-        unless ($store->{handler_is_installed}) {
-            on_scope_end {
-                $RemoveSubs->($cleanee, $store, keys %{ $store->{remove} });
-            };
-            $store->{handler_is_installed} = 1;
-        }
-
-        return 1;
-    }
-}
-
 =head2 unimport
 
 This method will be called when you do a
@@ -288,38 +304,10 @@
 
 It will start a new section of code that defines functions to clean up.
 
-=cut
-
-sub unimport {
-    my ($pragma, %args) = @_;
-
-    # the calling class, the current functions and our storage
-    my $cleanee   = exists $args{ -cleanee } ? $args{ -cleanee } : scalar caller;
-    my $functions = $pragma->get_functions($cleanee);
-    my $store     = $pragma->get_class_store($cleanee);
-
-    # register all unknown previous functions as excluded
-    for my $f (keys %$functions) {
-        next if $store->{remove}{ $f }
-             or $store->{exclude}{ $f };
-        $store->{exclude}{ $f } = 1;
-    }
-
-    return 1;
-}
-
 =head2 get_class_store
 
-This returns a reference to a hash in a passed package containing 
+This returns a reference to a hash in a passed package containing
 information about function names included and excluded from removal.
-
-=cut
-
-sub get_class_store {
-    my ($pragma, $class) = @_;
-    no strict 'refs';
-    return \%{ "${class}::${STORAGE_VAR}" };
-}
 
 =head2 get_functions
 
@@ -327,29 +315,9 @@
 in it as a hash reference with the function name as key and a typeglob
 reference to the symbol as value.
 
-=cut
-
-sub get_functions {
-    my ($pragma, $class) = @_;
-
-    return {
-        map  { @$_ }                                        # key => value
-        grep { *{ $_->[1] }{CODE} }                         # only functions
-        map  { [$_, qualify_to_ref( $_, $class )] }         # get globref
-        grep { $_ !~ /::$/ }                                # no packages
-        do   { no strict 'refs'; keys %{ "${class}::" } }   # symbol entries
-    };
-}
-
-=head1 BUGS
-
-C<namespace::clean> will clobber any formats that have the same name as
-a deleted sub. This is due to a bug in perl that makes it impossible to
-re-assign the FORMAT ref into a new glob.
-
 =head1 IMPLEMENTATION DETAILS
 
-This module works through the effect that a 
+This module works through the effect that a
 
   delete $SomePackage::{foo};
 
@@ -368,17 +336,34 @@
 
 L<B::Hooks::EndOfScope>
 
-=head1 AUTHOR AND COPYRIGHT
-
-Robert 'phaylon' Sedlacek C<E<lt>rs at 474.atE<gt>>, with many thanks to
-Matt S Trout for the inspiration on the whole idea.
-
-=head1 LICENSE
-
-This program is free software; you can redistribute it and/or modify 
-it under the same terms as perl itself.
+=head1 THANKS
+
+Many thanks to Matt S Trout for the inspiration on the whole idea.
+
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+Robert 'phaylon' Sedlacek <rs at 474.at>
+
+=item *
+
+Florian Ragwitz <rafl at debian.org>
+
+=item *
+
+Jesse Luehrs <doy at tozt.net>
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2010 by Robert 'phaylon' Sedlacek.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
 
 =cut
 
-no warnings;
-'Danger! Laws of Thermodynamics may not apply.'

Modified: trunk/libnamespace-clean-perl/t/00-basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/t/00-basic.t?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/t/00-basic.t (original)
+++ trunk/libnamespace-clean-perl/t/00-basic.t Sun Jun  6 05:09:40 2010
@@ -8,7 +8,7 @@
 
 use ExporterTest qw( foo bar );
 
-BEGIN { 
+BEGIN {
     ok( main->can('foo'), 'methods are there before cleanup' );
     eval { require namespace::clean ;; namespace::clean->import };
     ok( !$@, 'module use ok' );

Modified: trunk/libnamespace-clean-perl/t/02-inheritance.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/t/02-inheritance.t?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/t/02-inheritance.t (original)
+++ trunk/libnamespace-clean-perl/t/02-inheritance.t Sun Jun  6 05:09:40 2010
@@ -21,7 +21,7 @@
     'parent function not available in subclass' );
 ok( Inheritance->can('bar'),
     'parent method available in subclass' );
-is( Inheritance->bar, 23, 
+is( Inheritance->bar, 23,
     'parent method works in subclass' );
 is( Inheritance->qux, 23,
     'subclass method calls to parent work' );

Modified: trunk/libnamespace-clean-perl/t/08-const-sub.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnamespace-clean-perl/t/08-const-sub.t?rev=58932&op=diff
==============================================================================
--- trunk/libnamespace-clean-perl/t/08-const-sub.t (original)
+++ trunk/libnamespace-clean-perl/t/08-const-sub.t Sun Jun  6 05:09:40 2010
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More;
+use Test::More 0.88;
 
 use constant CONST => 123;
 use namespace::clean;




More information about the Pkg-perl-cvs-commits mailing list