From: Yuval Kogman Date: Thu, 17 Sep 2009 21:06:59 +0000 (+0300) Subject: use namespace::clean in Class::MOP:: classes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0ac13f34f5a2842dca63fef95213439c25ac5146;p=gitmo%2FClass-MOP.git use namespace::clean in Class::MOP:: classes --- diff --git a/Makefile.PL b/Makefile.PL index 7edc92e..56da3ca 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -19,9 +19,10 @@ if ( -d '.git' || $ENV{MAINTAINER_MODE} ) { requires 'Carp'; requires 'Devel::GlobalDestruction'; -requires 'MRO::Compat' => '0.05'; -requires 'Scalar::Util' => '1.18'; -requires 'Sub::Name' => '0.04'; +requires 'MRO::Compat' => '0.05'; +requires 'Scalar::Util' => '1.18'; +requires 'Sub::Name' => '0.04'; +requires 'namespace::clean' => '0.11'; requires 'Task::Weaken'; test_requires 'File::Spec'; diff --git a/lib/Class/MOP/Attribute.pm b/lib/Class/MOP/Attribute.pm index 6b26e95..b9e66dc 100644 --- a/lib/Class/MOP/Attribute.pm +++ b/lib/Class/MOP/Attribute.pm @@ -9,6 +9,8 @@ use Class::MOP::Method::Accessor; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 7d7561a..9fd58db 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -14,6 +14,8 @@ use Scalar::Util 'blessed', 'reftype', 'weaken'; use Sub::Name 'subname'; use Devel::GlobalDestruction 'in_global_destruction'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Deprecated.pm b/lib/Class/MOP/Deprecated.pm index ed0f81b..bce8902 100644 --- a/lib/Class/MOP/Deprecated.pm +++ b/lib/Class/MOP/Deprecated.pm @@ -6,6 +6,12 @@ use warnings; use Carp qw( cluck ); use Scalar::Util qw( blessed ); +use namespace::clean; + +# force loading of everything to prevent namespace::clean in the patched +# packages from deleting our symbols +use Class::MOP; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -125,7 +131,7 @@ sub get_method_map { my $map = $self->_full_method_map; $map->{$_} = $self->get_method($_) - for grep { !blessed( $map->{$_} ) } keys %{$map}; + for grep { !Scalar::Util::blessed( $map->{$_} ) } keys %{$map}; return $map; } diff --git a/lib/Class/MOP/Instance.pm b/lib/Class/MOP/Instance.pm index 1482554..19fdd5f 100644 --- a/lib/Class/MOP/Instance.pm +++ b/lib/Class/MOP/Instance.pm @@ -6,6 +6,8 @@ use warnings; use Scalar::Util 'weaken', 'blessed'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Method.pm b/lib/Class/MOP/Method.pm index ee4b12b..7bd9b7a 100644 --- a/lib/Class/MOP/Method.pm +++ b/lib/Class/MOP/Method.pm @@ -7,6 +7,8 @@ use warnings; use Carp 'confess'; use Scalar::Util 'weaken', 'reftype', 'blessed'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Method/Accessor.pm b/lib/Class/MOP/Method/Accessor.pm index 5380f67..db1a160 100644 --- a/lib/Class/MOP/Method/Accessor.pm +++ b/lib/Class/MOP/Method/Accessor.pm @@ -7,6 +7,8 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Method/Constructor.pm b/lib/Class/MOP/Method/Constructor.pm index 23d4f41..faa7d42 100644 --- a/lib/Class/MOP/Method/Constructor.pm +++ b/lib/Class/MOP/Method/Constructor.pm @@ -7,6 +7,8 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken', 'looks_like_number'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Method/Generated.pm b/lib/Class/MOP/Method/Generated.pm index d80f704..0e84716 100644 --- a/lib/Class/MOP/Method/Generated.pm +++ b/lib/Class/MOP/Method/Generated.pm @@ -6,6 +6,8 @@ use warnings; use Carp 'confess'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Method/Inlined.pm b/lib/Class/MOP/Method/Inlined.pm index 9fa9335..5d9cbdf 100644 --- a/lib/Class/MOP/Method/Inlined.pm +++ b/lib/Class/MOP/Method/Inlined.pm @@ -6,6 +6,8 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Method/Wrapped.pm b/lib/Class/MOP/Method/Wrapped.pm index e9b1d16..99bd934 100644 --- a/lib/Class/MOP/Method/Wrapped.pm +++ b/lib/Class/MOP/Method/Wrapped.pm @@ -7,6 +7,9 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed'; +use namespace::clean; + + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Module.pm b/lib/Class/MOP/Module.pm index 5e0c116..955ab1b 100644 --- a/lib/Class/MOP/Module.pm +++ b/lib/Class/MOP/Module.pm @@ -7,6 +7,8 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Object.pm b/lib/Class/MOP/Object.pm index 00e8a8f..515d7b1 100644 --- a/lib/Class/MOP/Object.pm +++ b/lib/Class/MOP/Object.pm @@ -6,6 +6,8 @@ use warnings; use Scalar::Util 'blessed'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 441f8c9..2705bd8 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -8,6 +8,8 @@ use Scalar::Util 'blessed', 'reftype'; use Carp 'confess'; use Sub::Name 'subname'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/metaclass.pm b/lib/metaclass.pm index fba0874..c1e836d 100644 --- a/lib/metaclass.pm +++ b/lib/metaclass.pm @@ -7,6 +7,8 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed'; +use namespace::clean; + our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/t/005_attributes.t b/t/005_attributes.t index b7a545b..b738e89 100644 --- a/t/005_attributes.t +++ b/t/005_attributes.t @@ -190,6 +190,8 @@ is($BAZ_ATTR->name, '$baz', '... got the attributes name correctly'); use metaclass; use Scalar::Util qw/blessed/; + use namespace::clean -except => "meta"; + my $meta = Buzz->meta; ::lives_ok { $meta->add_attribute($FOO_ATTR_2);