r47473 - in /branches/upstream/libclass-mop-perl/current: ./ lib/ lib/Class/ lib/Class/MOP/ lib/Class/MOP/Class/Immutable/ lib/Class/MOP/Method/ t/ xs/ xt/author/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Thu Nov 19 16:22:12 UTC 2009
Author: jawnsy-guest
Date: Thu Nov 19 16:22:06 2009
New Revision: 47473
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47473
Log:
[svn-upgrade] Integrating new upstream version, libclass-mop-perl (0.95)
Modified:
branches/upstream/libclass-mop-perl/current/Changes
branches/upstream/libclass-mop-perl/current/META.yml
branches/upstream/libclass-mop-perl/current/Makefile.PL
branches/upstream/libclass-mop-perl/current/README
branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class/Immutable/Trait.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Deprecated.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Instance.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Accessor.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Constructor.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Generated.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Inlined.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Wrapped.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Module.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Object.pm
branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Package.pm
branches/upstream/libclass-mop-perl/current/lib/metaclass.pm
branches/upstream/libclass-mop-perl/current/t/010_self_introspection.t
branches/upstream/libclass-mop-perl/current/t/049_metaclass_reinitialize.t
branches/upstream/libclass-mop-perl/current/t/083_load_class.t
branches/upstream/libclass-mop-perl/current/t/500_deprecated.t
branches/upstream/libclass-mop-perl/current/xs/MOP.xs
branches/upstream/libclass-mop-perl/current/xt/author/pod_coverage.t
Modified: branches/upstream/libclass-mop-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/Changes?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/Changes (original)
+++ branches/upstream/libclass-mop-perl/current/Changes Thu Nov 19 16:22:06 2009
@@ -1,11 +1,33 @@
Revision history for Perl extension Class-MOP.
+0.95 Wed, Nov 19, 2009
+ * Class::MOP
+ - Make is_class_loaded without any arguments fail loudly
+ (Florian Ragwitz).
+ - Make load_class throw more standard error messages when loading single
+ modules (nothingmuch).
+
+ * Class::MOP::Package
+ - Stop add_method from behaving differently under the debugger
+ (Florian Ragwitz).
+
+ * Class::MOP::Class
+ * Class::MOP::Package
+ - Any method which takes a method name as an argument now allows names
+ which are false (like "0"), but the name must be defined and not be an
+ empty string. (Dave Rolsky)
+
+ * Class::MOP::Class
+ - Deprecated get_attribute_map as a public method. You can use a
+ combination of get_attribute_list and get_attribute instead. (Dave
+ Rolsky)
+
0.94 Tue, Sep 22, 2009
* Class::MOP::Attribute
- - Introduce set_raw_value and get_raw_value, side effect free variants
- of {get,set}_value. These don't do anything useful in Class::MOP but
- have different behavior that set_value and get_value for Moose
- attributes. (nothingmuch)
+ - Introduce set_raw_value and get_raw_value, side effect free variants
+ of {get,set}_value. These don't do anything useful in Class::MOP but
+ have different behavior that set_value and get_value for Moose
+ attributes. (nothingmuch)
0.93 Tue, Sep 15, 2009
* Class::MOP
@@ -241,7 +263,7 @@
* Many methods have been renamed with a leading underscore, and a
few have been deprecated entirely. The methods with a leading
- underscore are consider "internals only". People writing
+ underscore are considered "internals only". People writing
subclasses or extensions to Class::MOP should feel free to
override them, but they are not for "public" use.
Modified: branches/upstream/libclass-mop-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/META.yml?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/META.yml (original)
+++ branches/upstream/libclass-mop-perl/current/META.yml Thu Nov 19 16:22:06 2009
@@ -29,7 +29,8 @@
Scalar::Util: 1.18
Sub::Name: 0.04
Task::Weaken: 0
+ Try::Tiny: 0.02
perl: 5.8.1
resources:
license: http://dev.perl.org/licenses/
-version: 0.94
+version: 0.95
Modified: branches/upstream/libclass-mop-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/Makefile.PL?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/Makefile.PL (original)
+++ branches/upstream/libclass-mop-perl/current/Makefile.PL Thu Nov 19 16:22:06 2009
@@ -22,6 +22,7 @@
requires 'MRO::Compat' => '0.05';
requires 'Scalar::Util' => '1.18';
requires 'Sub::Name' => '0.04';
+requires 'Try::Tiny' => '0.02';
requires 'Task::Weaken';
test_requires 'File::Spec';
Modified: branches/upstream/libclass-mop-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/README?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/README (original)
+++ branches/upstream/libclass-mop-perl/current/README Thu Nov 19 16:22:06 2009
@@ -1,4 +1,4 @@
-Class::MOP version 0.94
+Class::MOP version 0.95
===========================
See the individual module documentation for more information
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP.pm Thu Nov 19 16:22:06 2009
@@ -10,6 +10,7 @@
use Carp 'confess';
use Scalar::Util 'weaken', 'reftype', 'blessed';
+use Try::Tiny;
use Class::MOP::Class;
use Class::MOP::Attribute;
@@ -24,7 +25,7 @@
*check_package_cache_flag = \&mro::get_pkg_gen;
}
-our $VERSION = '0.94';
+our $VERSION = '0.95';
our $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -75,7 +76,7 @@
sub load_first_existing_class {
my @classes = @_
- or return;
+ or return;
foreach my $class (@classes) {
unless ( _is_valid_class_name($class) ) {
@@ -86,49 +87,31 @@
my $found;
my %exceptions;
+
for my $class (@classes) {
- my $e = _try_load_one_class($class);
-
- if ($e) {
- my $pmfile = _class_to_pmfile($class);
- $exceptions{$class} = $e;
- last if $e !~ /^Can't locate \Q$pmfile\E in \@INC/;
+ my $file = _class_to_pmfile($class);
+
+ return $class if is_class_loaded($class);;
+
+ return $class if try {
+ local $SIG{__DIE__};
+ require $file;
+ return 1;
}
- else {
- $found = $class;
- last;
- }
+ catch {
+ unless (/^Can't locate \Q$file\E in \@INC/) {
+ confess "Couldn't load class ($class) because: $_";
+ }
+
+ return;
+ };
}
- return $found if $found;
-
- confess join(
- "\n",
- map {
- sprintf(
- "Could not load class (%s) because : %s", $_,
- $exceptions{$_}
- )
- }
- grep {
- exists $exceptions{$_}
- } @classes
- );
-}
-
-sub _try_load_one_class {
- my $class = shift;
-
- return if is_class_loaded($class);
-
- my $file = _class_to_pmfile($class);
-
- return do {
- local $@;
- local $SIG{__DIE__};
- eval { require($file) };
- $@;
- };
+ if ( @classes > 1 ) {
+ confess "Can't locate any of @classes in \@INC (\@INC contains: @INC).";
+ } else {
+ confess "Can't locate " . _class_to_pmfile($classes[0]) . " in \@INC (\@INC contains: @INC).";
+ }
}
sub load_class {
@@ -299,7 +282,7 @@
#
# we just alias the original method
# rather than re-produce it here
- 'get_attribute_map' => \&Class::MOP::Class::get_attribute_map
+ '_attribute_map' => \&Class::MOP::Class::_attribute_map
},
default => sub { {} }
))
@@ -919,7 +902,7 @@
If the module cannot be loaded, an exception is thrown.
-For historical reasons, this function returns explicitly returns a true value.
+For historical reasons, this function explicitly returns a true value.
=item B<Class::MOP::is_class_loaded($class_name)>
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Attribute.pm Thu Nov 19 16:22:06 2009
@@ -8,8 +8,9 @@
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-
-our $VERSION = '0.94';
+use Try::Tiny;
+
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -369,7 +370,7 @@
else {
my $inline_me = ($generate_as_inline_methods && $self->associated_class->instance_metaclass->is_inlinable);
my $method;
- eval {
+ try {
if ( $method_ctx ) {
my $desc = "accessor $accessor";
if ( $accessor ne $self->name ) {
@@ -387,8 +388,10 @@
name => $accessor,
definition_context => $method_ctx,
);
+ }
+ catch {
+ confess "Could not create the '$type' method for " . $self->name . " because : $_";
};
- confess "Could not create the '$type' method for " . $self->name . " because : $@" if $@;
$self->associate_method($method);
return ($accessor, $method);
}
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class.pm Thu Nov 19 16:22:06 2009
@@ -13,8 +13,9 @@
use Scalar::Util 'blessed', 'reftype', 'weaken';
use Sub::Name 'subname';
use Devel::GlobalDestruction 'in_global_destruction';
-
-our $VERSION = '0.94';
+use Try::Tiny;
+
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -328,7 +329,7 @@
# all these attribute readers will be bootstrapped
# away in the Class::MOP bootstrap section
-sub get_attribute_map { $_[0]->{'attributes'} }
+sub _attribute_map { $_[0]->{'attributes'} }
sub attribute_metaclass { $_[0]->{'attribute_metaclass'} }
sub instance_metaclass { $_[0]->{'instance_metaclass'} }
sub immutable_trait { $_[0]->{'immutable_trait'} }
@@ -595,7 +596,7 @@
sub add_before_method_modifier {
my ($self, $method_name, $method_modifier) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must pass in a method name";
my $method = $fetch_and_prepare_method->($self, $method_name);
$method->add_before_modifier(
@@ -605,7 +606,7 @@
sub add_after_method_modifier {
my ($self, $method_name, $method_modifier) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must pass in a method name";
my $method = $fetch_and_prepare_method->($self, $method_name);
$method->add_after_modifier(
@@ -615,7 +616,7 @@
sub add_around_method_modifier {
my ($self, $method_name, $method_modifier) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must pass in a method name";
my $method = $fetch_and_prepare_method->($self, $method_name);
$method->add_around_modifier(
@@ -639,7 +640,7 @@
sub find_method_by_name {
my ($self, $method_name) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must define a method name to find";
foreach my $class ($self->linearized_isa) {
my $method = $self->initialize($class)->get_method($method_name);
@@ -670,7 +671,7 @@
sub find_all_methods_by_name {
my ($self, $method_name) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must define a method name to find";
my @methods;
foreach my $class ($self->linearized_isa) {
@@ -687,7 +688,7 @@
sub find_next_method_by_name {
my ($self, $method_name) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must define a method name to find";
my @cpl = $self->linearized_isa;
shift @cpl; # discard ourselves
@@ -728,23 +729,21 @@
# get our count of previously inserted attributes and
# increment by one so this attribute knows its order
- my $order = (scalar keys %{$self->get_attribute_map});
+ my $order = (scalar keys %{$self->_attribute_map});
$attribute->_set_insertion_order($order);
# then onto installing the new accessors
- $self->get_attribute_map->{$attr_name} = $attribute;
+ $self->_attribute_map->{$attr_name} = $attribute;
# invalidate package flag here
- my $e = do {
- local $@;
+ try {
local $SIG{__DIE__};
- eval { $attribute->install_accessors() };
- $@;
+ $attribute->install_accessors();
+ }
+ catch {
+ $self->remove_attribute($attr_name);
+ die $_;
};
- if ( $e ) {
- $self->remove_attribute($attr_name);
- die $e;
- }
return $attribute;
}
@@ -814,14 +813,14 @@
my ($self, $attribute_name) = @_;
(defined $attribute_name)
|| confess "You must define an attribute name";
- exists $self->get_attribute_map->{$attribute_name};
+ exists $self->_attribute_map->{$attribute_name};
}
sub get_attribute {
my ($self, $attribute_name) = @_;
(defined $attribute_name)
|| confess "You must define an attribute name";
- return $self->get_attribute_map->{$attribute_name}
+ return $self->_attribute_map->{$attribute_name}
# NOTE:
# this will return undef anyway, so no need ...
# if $self->has_attribute($attribute_name);
@@ -832,9 +831,9 @@
my ($self, $attribute_name) = @_;
(defined $attribute_name)
|| confess "You must define an attribute name";
- my $removed_attribute = $self->get_attribute_map->{$attribute_name};
+ my $removed_attribute = $self->_attribute_map->{$attribute_name};
return unless defined $removed_attribute;
- delete $self->get_attribute_map->{$attribute_name};
+ delete $self->_attribute_map->{$attribute_name};
$self->invalidate_meta_instances();
$removed_attribute->remove_accessors();
$removed_attribute->detach_from_class();
@@ -843,12 +842,12 @@
sub get_attribute_list {
my $self = shift;
- keys %{$self->get_attribute_map};
+ keys %{$self->_attribute_map};
}
sub get_all_attributes {
my $self = shift;
- my %attrs = map { %{ $self->initialize($_)->get_attribute_map } } reverse $self->linearized_isa;
+ my %attrs = map { %{ $self->initialize($_)->_attribute_map } } reverse $self->linearized_isa;
return values %attrs;
}
@@ -1447,12 +1446,6 @@
named attribute. It does not include attributes inherited from parent
classes.
-=item B<< $metaclass->get_attribute_map >>
-
-Returns a hash reference representing the attributes defined in this
-class. The keys are attribute names and the values are
-L<Class::MOP::Attribute> objects.
-
=item B<< $metaclass->get_attribute_list >>
This will return a list of attributes I<names> for all attributes
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class/Immutable/Trait.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class/Immutable/Trait.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class/Immutable/Trait.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Class/Immutable/Trait.pm Thu Nov 19 16:22:06 2009
@@ -8,7 +8,7 @@
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Deprecated.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Deprecated.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Deprecated.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Deprecated.pm Thu Nov 19 16:22:06 2009
@@ -6,7 +6,7 @@
use Carp qw( cluck );
use Scalar::Util qw( blessed );
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -26,6 +26,7 @@
'Class::MOP::Class::alias_method' => 0.93,
'Class::MOP::Class::compute_all_applicable_methods' => 0.93,
'Class::MOP::Class::compute_all_applicable_attributes' => 0.93,
+ 'Class::MOP::Class::get_attribute_map' => 0.95,
'Class::MOP::Instance::bless_instance_structure' => 0.93,
@@ -205,6 +206,13 @@
shift->get_all_attributes(@_);
}
+sub get_attribute_map {
+ Class::MOP::Deprecated::warn(
+ "The get_attribute_map method has been deprecated.\n");
+
+ shift->_attribute_map(@_);
+}
+
package
Class::MOP::Instance;
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Instance.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Instance.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Instance.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Instance.pm Thu Nov 19 16:22:06 2009
@@ -6,7 +6,7 @@
use Scalar::Util 'weaken', 'blessed';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method.pm Thu Nov 19 16:22:06 2009
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'weaken', 'reftype', 'blessed';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Accessor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Accessor.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Accessor.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Accessor.pm Thu Nov 19 16:22:06 2009
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Constructor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Constructor.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Constructor.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Constructor.pm Thu Nov 19 16:22:06 2009
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken', 'looks_like_number';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Generated.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Generated.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Generated.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Generated.pm Thu Nov 19 16:22:06 2009
@@ -6,7 +6,7 @@
use Carp 'confess';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Inlined.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Inlined.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Inlined.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Inlined.pm Thu Nov 19 16:22:06 2009
@@ -6,7 +6,7 @@
use Carp 'confess';
use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Wrapped.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Wrapped.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Wrapped.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Method/Wrapped.pm Thu Nov 19 16:22:06 2009
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Module.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Module.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Module.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Module.pm Thu Nov 19 16:22:06 2009
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Object.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Object.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Object.pm Thu Nov 19 16:22:06 2009
@@ -6,7 +6,7 @@
use Scalar::Util 'blessed';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Package.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Package.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Package.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/Class/MOP/Package.pm Thu Nov 19 16:22:06 2009
@@ -8,7 +8,7 @@
use Carp 'confess';
use Sub::Name 'subname';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
@@ -311,7 +311,7 @@
sub add_method {
my ($self, $method_name, $method) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must define a method name";
my $body;
@@ -320,7 +320,7 @@
if ($method->package_name ne $self->name) {
$method = $method->clone(
package_name => $self->name,
- name => $method_name
+ name => $method_name,
) if $method->can('clone');
}
@@ -336,7 +336,7 @@
my ( $current_package, $current_name ) = Class::MOP::get_code_info($body);
- if ( !defined $current_name || $current_name eq '__ANON__' ) {
+ if ( !defined $current_name || $current_name =~ /^__ANON__/ ) {
my $full_method_name = ($self->name . '::' . $method_name);
subname($full_method_name => $body);
}
@@ -358,7 +358,8 @@
sub has_method {
my ($self, $method_name) = @_;
- (defined $method_name && $method_name)
+
+ (defined $method_name && length $method_name)
|| confess "You must define a method name";
return defined($self->get_method($method_name));
@@ -366,7 +367,8 @@
sub get_method {
my ( $self, $method_name ) = @_;
- ( defined $method_name && $method_name )
+
+ (defined $method_name && length $method_name)
|| confess "You must define a method name";
my $method_map = $self->_method_map;
@@ -402,7 +404,7 @@
sub remove_method {
my ($self, $method_name) = @_;
- (defined $method_name && $method_name)
+ (defined $method_name && length $method_name)
|| confess "You must define a method name";
my $removed_method = delete $self->_full_method_map->{$method_name};
Modified: branches/upstream/libclass-mop-perl/current/lib/metaclass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/lib/metaclass.pm?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/lib/metaclass.pm (original)
+++ branches/upstream/libclass-mop-perl/current/lib/metaclass.pm Thu Nov 19 16:22:06 2009
@@ -7,7 +7,7 @@
use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.94';
+our $VERSION = '0.95';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
Modified: branches/upstream/libclass-mop-perl/current/t/010_self_introspection.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/t/010_self_introspection.t?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/t/010_self_introspection.t (original)
+++ branches/upstream/libclass-mop-perl/current/t/010_self_introspection.t Thu Nov 19 16:22:06 2009
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 304;
+use Test::More tests => 306;
use Test::Exception;
use Class::MOP;
@@ -90,7 +90,9 @@
add_before_method_modifier add_after_method_modifier add_around_method_modifier
has_attribute get_attribute add_attribute remove_attribute
- get_attribute_list get_attribute_map get_all_attributes compute_all_applicable_attributes find_attribute_by_name
+ get_attribute_list _attribute_map get_all_attributes compute_all_applicable_attributes find_attribute_by_name
+
+ get_attribute_map
is_mutable is_immutable make_mutable make_immutable
_initialize_immutable _install_inlined_code _inlined_methods
@@ -194,7 +196,7 @@
);
is_deeply(
- [ sort keys %{$class_mop_class_meta->get_attribute_map} ],
+ [ sort keys %{$class_mop_class_meta->_attribute_map} ],
[ sort @class_mop_class_attributes ],
'... got the right list of attributes');
@@ -211,7 +213,7 @@
'... got the right list of attributes');
is_deeply(
- [ sort keys %{$class_mop_package_meta->get_attribute_map} ],
+ [ sort keys %{$class_mop_package_meta->_attribute_map} ],
[ sort @class_mop_package_attributes ],
'... got the right list of attributes');
@@ -228,7 +230,7 @@
'... got the right list of attributes');
is_deeply(
- [ sort keys %{$class_mop_module_meta->get_attribute_map} ],
+ [ sort keys %{$class_mop_module_meta->_attribute_map} ],
[ sort @class_mop_module_attributes ],
'... got the right list of attributes');
@@ -282,8 +284,8 @@
ok($class_mop_class_meta->get_attribute('attributes')->has_reader, '... Class::MOP::Class attributes has a reader');
is_deeply($class_mop_class_meta->get_attribute('attributes')->reader,
- { 'get_attribute_map' => \&Class::MOP::Class::get_attribute_map },
- '... Class::MOP::Class attributes\'s a reader is &get_attribute_map');
+ { '_attribute_map' => \&Class::MOP::Class::_attribute_map },
+ '... Class::MOP::Class attributes\'s a reader is &_attribute_map');
ok($class_mop_class_meta->get_attribute('attributes')->has_init_arg, '... Class::MOP::Class attributes has a init_arg');
is($class_mop_class_meta->get_attribute('attributes')->init_arg,
Modified: branches/upstream/libclass-mop-perl/current/t/049_metaclass_reinitialize.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/t/049_metaclass_reinitialize.t?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/t/049_metaclass_reinitialize.t (original)
+++ branches/upstream/libclass-mop-perl/current/t/049_metaclass_reinitialize.t Thu Nov 19 16:22:06 2009
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More;
+use Test::More tests => 14;
use Test::Exception;
{
@@ -39,5 +39,3 @@
throws_ok {
$meta->reinitialize($meta->new_object);
} qr/You must pass a package name or an existing Class::MOP::Package instance/;
-
-done_testing;
Modified: branches/upstream/libclass-mop-perl/current/t/083_load_class.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/t/083_load_class.t?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/t/083_load_class.t (original)
+++ branches/upstream/libclass-mop-perl/current/t/083_load_class.t Thu Nov 19 16:22:06 2009
@@ -6,7 +6,10 @@
require Class::MOP;
use lib 't/lib';
-ok(!Class::MOP::is_class_loaded(), "is_class_loaded with no argument returns false");
+dies_ok {
+ Class::MOP::is_class_loaded()
+} "is_class_loaded with no argument dies";
+
ok(!Class::MOP::is_class_loaded(''), "can't load the empty class");
ok(!Class::MOP::is_class_loaded(\"foo"), "can't load a class name reference??");
@@ -62,8 +65,8 @@
throws_ok {
Class::MOP::load_class('This::Does::Not::Exist');
}
-qr/Could not load class \(This::Does::Not::Exist\) because :/,
- 'Many Moose tests rely on the exact formatting of this error';
+qr{Can't locate This/Does/Not/Exist\.pm in \@INC},
+ 'load_first_existing_class throws a familiar error for a single module';
{
package Other;
@@ -87,7 +90,7 @@
throws_ok {
Class::MOP::load_first_existing_class("Does::Not::Exist", "Also::Does::Not::Exist")
-} qr/Could not load class \(Does::Not::Exist.*Could not load class \(Also::Does::Not::Exist/s, 'Multiple non-existant classes cause exception';
+} qr/Does::Not::Exist.*Also::Does::Not::Exist/s, 'Multiple non-existant classes cause exception';
{
sub whatever {
Modified: branches/upstream/libclass-mop-perl/current/t/500_deprecated.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/t/500_deprecated.t?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/t/500_deprecated.t (original)
+++ branches/upstream/libclass-mop-perl/current/t/500_deprecated.t Thu Nov 19 16:22:06 2009
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 7;
use Test::Exception;
use Carp;
@@ -10,47 +10,51 @@
{
package Foo;
- use Test::More;
- use Test::Exception;
- throws_ok {
+ ::throws_ok{
Class::MOP::in_global_destruction();
- } qr/\b deprecated \b/xmsi, 'complained';
+ } qr/\b deprecated \b/xmsi,
+ 'Class::MOP::in_global_destruction is deprecated';
}
{
package Bar;
- use Test::More;
- use Test::Exception;
use Class::MOP::Deprecated -compatible => 0.93;
- throws_ok {
+ ::throws_ok{
Class::MOP::in_global_destruction();
- } qr/\b deprecated \b/xmsi, 'complained';
+ } qr/\b deprecated \b/xmsi,
+ 'Class::MOP::in_global_destruction is deprecated with 0.93 compatibility';
}
{
package Baz;
- use Test::More;
- use Test::Exception;
use Class::MOP::Deprecated -compatible => 0.92;
- lives_ok {
+ ::lives_ok{
Class::MOP::in_global_destruction();
- } 'safe';
+ }
+ 'Class::MOP::in_global_destruction is not deprecated with 0.92 compatibility';
}
-
{
package Baz::Inner;
- use Test::More;
- use Test::Exception;
- lives_ok {
+ ::lives_ok{
Class::MOP::in_global_destruction();
- } 'safe in an inner class';
+ } 'safe in an inner class';
+}
+
+{
+ package Foo2;
+
+ use metaclass;
+
+ ::throws_ok{ Foo2->meta->get_attribute_map }
+ qr/\Qget_attribute_map method has been deprecated/,
+ 'get_attribute_map is deprecated';
}
{
@@ -68,9 +72,13 @@
my $map = Quux->meta->get_method_map;
my @method_objects = grep { blessed($_) } values %{$map};
- ::is( scalar @method_objects, 3,
- 'get_method_map still returns all values as method object' );
- ::is_deeply( [ sort keys %{$map} ],
- [ qw( bar foo meta ) ],
- 'get_method_map returns expected methods' );
+ ::is(
+ scalar @method_objects, 3,
+ 'get_method_map still returns all values as method object'
+ );
+ ::is_deeply(
+ [ sort keys %{$map} ],
+ [qw( bar foo meta )],
+ 'get_method_map returns expected methods'
+ );
}
Modified: branches/upstream/libclass-mop-perl/current/xs/MOP.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/xs/MOP.xs?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/xs/MOP.xs (original)
+++ branches/upstream/libclass-mop-perl/current/xs/MOP.xs Thu Nov 19 16:22:06 2009
@@ -50,11 +50,8 @@
mPUSHs(newSVpv(name, 0));
}
-# This is some pretty grotty logic. It _should_ be parallel to the
-# pure Perl version in lib/Class/MOP.pm, so if you want to understand
-# it we suggest you start there.
void
-is_class_loaded(klass=&PL_sv_undef)
+is_class_loaded(klass)
SV *klass
PREINIT:
HV *stash;
Modified: branches/upstream/libclass-mop-perl/current/xt/author/pod_coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-mop-perl/current/xt/author/pod_coverage.t?rev=47473&op=diff
==============================================================================
--- branches/upstream/libclass-mop-perl/current/xt/author/pod_coverage.t (original)
+++ branches/upstream/libclass-mop-perl/current/xt/author/pod_coverage.t Thu Nov 19 16:22:06 2009
@@ -43,6 +43,9 @@
# doc'd with rebless_instance
'rebless_instance_away',
+
+ # deprecated
+ 'get_attribute_map',
],
'Class::MOP::Class::Immutable::Trait' => ['.+'],
'Class::MOP::Class::Immutable::Class::MOP::Class' => ['.+'],
More information about the Pkg-perl-cvs-commits
mailing list