From: Stevan Little Date: Tue, 8 Jul 2008 00:42:32 +0000 (+0000) Subject: some refactoring of handles X-Git-Tag: 0_55~51 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=330dbb079ab3e4ff26fb694c232b9c86b2d19161;p=gitmo%2FMoose.git some refactoring of handles --- diff --git a/Changes b/Changes index ae695e2..ad3e7c3 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,12 @@ Revision history for Perl extension Moose +0.55 + + * Moose::Meta::Attribute + - breaking down the way 'handles' methods are + created so that the process can be more easily + overridden by subclasses (stevan) + 0.54 Thurs. July 3, 2008 ... this is not my day today ... diff --git a/lib/Moose.pm b/lib/Moose.pm index 766a346..ecc8801 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -4,7 +4,7 @@ package Moose; use strict; use warnings; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use Scalar::Util 'blessed'; diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 387a88f..d631120 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -8,7 +8,7 @@ use Scalar::Util 'blessed', 'weaken'; use Carp 'confess'; use overload (); -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use Moose::Meta::Method::Accessor; @@ -555,12 +555,10 @@ sub install_delegation { # this will sort out any details and always # return an hash of methods which we want # to delagate to, see that method for details - my %handles = $self->_canonicalize_handles(); + my %handles = $self->_canonicalize_handles; # find the accessor method for this attribute - my $accessor = $self->get_read_method_ref; - # then unpack it if we need too ... - $accessor = $accessor->body if blessed $accessor; + my $accessor = $self->_get_delegate_accessor; # install the delegation ... my $associated_class = $self->associated_class; @@ -609,6 +607,16 @@ sub install_delegation { # private methods to help delegation ... +sub _get_delegate_accessor { + my $self = shift; + # find the accessor method for this attribute + my $accessor = $self->get_read_method_ref; + # then unpack it if we need too ... + $accessor = $accessor->body if blessed $accessor; + # return the accessor + return $accessor; +} + sub _canonicalize_handles { my $self = shift; my $handles = $self->handles; diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index 89ad5ad..92a84b1 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -9,7 +9,7 @@ use Class::MOP; use Carp 'confess'; use Scalar::Util 'weaken', 'blessed'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use Moose::Meta::Method::Overriden; diff --git a/lib/Moose/Meta/Instance.pm b/lib/Moose/Meta/Instance.pm index 0258e3f..00da5df 100644 --- a/lib/Moose/Meta/Instance.pm +++ b/lib/Moose/Meta/Instance.pm @@ -4,7 +4,7 @@ package Moose::Meta::Instance; use strict; use warnings; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base "Class::MOP::Instance"; diff --git a/lib/Moose/Meta/Method.pm b/lib/Moose/Meta/Method.pm index a3603fc..6f670ce 100644 --- a/lib/Moose/Meta/Method.pm +++ b/lib/Moose/Meta/Method.pm @@ -3,7 +3,7 @@ package Moose::Meta::Method; use strict; use warnings; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Method'; diff --git a/lib/Moose/Meta/Method/Accessor.pm b/lib/Moose/Meta/Method/Accessor.pm index f126242..e96b83a 100644 --- a/lib/Moose/Meta/Method/Accessor.pm +++ b/lib/Moose/Meta/Method/Accessor.pm @@ -6,7 +6,7 @@ use warnings; use Carp 'confess'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method', diff --git a/lib/Moose/Meta/Method/Augmented.pm b/lib/Moose/Meta/Method/Augmented.pm index 1003324..61a9ee7 100644 --- a/lib/Moose/Meta/Method/Augmented.pm +++ b/lib/Moose/Meta/Method/Augmented.pm @@ -5,7 +5,7 @@ use warnings; use Carp 'confess'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method'; diff --git a/lib/Moose/Meta/Method/Constructor.pm b/lib/Moose/Meta/Method/Constructor.pm index e8f023c..6dc6f04 100644 --- a/lib/Moose/Meta/Method/Constructor.pm +++ b/lib/Moose/Meta/Method/Constructor.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken', 'looks_like_number'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method', diff --git a/lib/Moose/Meta/Method/Destructor.pm b/lib/Moose/Meta/Method/Destructor.pm index e6c8749..886c4cc 100644 --- a/lib/Moose/Meta/Method/Destructor.pm +++ b/lib/Moose/Meta/Method/Destructor.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method', diff --git a/lib/Moose/Meta/Method/Overriden.pm b/lib/Moose/Meta/Method/Overriden.pm index 3f97d2d..844c0f6 100644 --- a/lib/Moose/Meta/Method/Overriden.pm +++ b/lib/Moose/Meta/Method/Overriden.pm @@ -5,7 +5,7 @@ use warnings; use Carp 'confess'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method'; diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 389a865..6129dc7 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -8,7 +8,7 @@ use metaclass; use Carp 'confess'; use Scalar::Util 'blessed'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use Moose::Meta::Class; diff --git a/lib/Moose/Meta/Role/Application.pm b/lib/Moose/Meta/Role/Application.pm index 0ab4b5f..dd8c30a 100644 --- a/lib/Moose/Meta/Role/Application.pm +++ b/lib/Moose/Meta/Role/Application.pm @@ -4,7 +4,7 @@ use strict; use warnings; use metaclass; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; __PACKAGE__->meta->add_attribute('method_exclusions' => ( diff --git a/lib/Moose/Meta/Role/Application/RoleSummation.pm b/lib/Moose/Meta/Role/Application/RoleSummation.pm index 2e22b34..bb4e652 100644 --- a/lib/Moose/Meta/Role/Application/RoleSummation.pm +++ b/lib/Moose/Meta/Role/Application/RoleSummation.pm @@ -10,7 +10,7 @@ use Data::Dumper; use Moose::Meta::Role::Composite; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role::Application'; diff --git a/lib/Moose/Meta/Role/Application/ToClass.pm b/lib/Moose/Meta/Role/Application/ToClass.pm index 6fb73eb..246b843 100644 --- a/lib/Moose/Meta/Role/Application/ToClass.pm +++ b/lib/Moose/Meta/Role/Application/ToClass.pm @@ -9,7 +9,7 @@ use Scalar::Util 'blessed'; use Data::Dumper; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role::Application'; diff --git a/lib/Moose/Meta/Role/Application/ToInstance.pm b/lib/Moose/Meta/Role/Application/ToInstance.pm index cc4c931..184bf64 100644 --- a/lib/Moose/Meta/Role/Application/ToInstance.pm +++ b/lib/Moose/Meta/Role/Application/ToInstance.pm @@ -7,7 +7,7 @@ use metaclass; use Carp 'confess'; use Scalar::Util 'blessed'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role::Application::ToClass'; diff --git a/lib/Moose/Meta/Role/Application/ToRole.pm b/lib/Moose/Meta/Role/Application/ToRole.pm index 571d285..5764550 100644 --- a/lib/Moose/Meta/Role/Application/ToRole.pm +++ b/lib/Moose/Meta/Role/Application/ToRole.pm @@ -9,7 +9,7 @@ use Scalar::Util 'blessed'; use Data::Dumper; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role::Application'; diff --git a/lib/Moose/Meta/Role/Composite.pm b/lib/Moose/Meta/Role/Composite.pm index 842606c..fb89a99 100644 --- a/lib/Moose/Meta/Role/Composite.pm +++ b/lib/Moose/Meta/Role/Composite.pm @@ -7,7 +7,7 @@ use metaclass; use Carp 'confess'; use Scalar::Util 'blessed'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role'; diff --git a/lib/Moose/Meta/Role/Method.pm b/lib/Moose/Meta/Role/Method.pm index 27b3f10..7e92915 100644 --- a/lib/Moose/Meta/Role/Method.pm +++ b/lib/Moose/Meta/Role/Method.pm @@ -4,7 +4,7 @@ package Moose::Meta::Role::Method; use strict; use warnings; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Method'; diff --git a/lib/Moose/Meta/Role/Method/Required.pm b/lib/Moose/Meta/Role/Method/Required.pm index 827f911..eb106a3 100644 --- a/lib/Moose/Meta/Role/Method/Required.pm +++ b/lib/Moose/Meta/Role/Method/Required.pm @@ -4,7 +4,7 @@ package Moose::Meta::Role::Method::Required; use strict; use warnings; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role::Method'; diff --git a/lib/Moose/Meta/TypeCoercion.pm b/lib/Moose/Meta/TypeCoercion.pm index f341d3a..3469caa 100644 --- a/lib/Moose/Meta/TypeCoercion.pm +++ b/lib/Moose/Meta/TypeCoercion.pm @@ -10,7 +10,7 @@ use Carp 'confess'; use Moose::Meta::Attribute; use Moose::Util::TypeConstraints (); -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; __PACKAGE__->meta->add_attribute('type_coercion_map' => ( diff --git a/lib/Moose/Meta/TypeCoercion/Union.pm b/lib/Moose/Meta/TypeCoercion/Union.pm index f52349f..b611370 100644 --- a/lib/Moose/Meta/TypeCoercion/Union.pm +++ b/lib/Moose/Meta/TypeCoercion/Union.pm @@ -8,7 +8,7 @@ use metaclass; use Carp 'confess'; use Scalar::Util 'blessed'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeCoercion'; diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index 368f314..8ae760c 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -11,7 +11,7 @@ use overload '""' => sub { shift->name }, # stringify to tc name use Carp 'confess'; use Scalar::Util qw(blessed refaddr); -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; __PACKAGE__->meta->add_attribute('name' => (reader => 'name')); diff --git a/lib/Moose/Meta/TypeConstraint/Class.pm b/lib/Moose/Meta/TypeConstraint/Class.pm index 3be25d5..e0debd2 100644 --- a/lib/Moose/Meta/TypeConstraint/Class.pm +++ b/lib/Moose/Meta/TypeConstraint/Class.pm @@ -7,7 +7,7 @@ use metaclass; use Scalar::Util 'blessed'; use Moose::Util::TypeConstraints (); -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; diff --git a/lib/Moose/Meta/TypeConstraint/Enum.pm b/lib/Moose/Meta/TypeConstraint/Enum.pm index 3303bd2..de66ea3 100644 --- a/lib/Moose/Meta/TypeConstraint/Enum.pm +++ b/lib/Moose/Meta/TypeConstraint/Enum.pm @@ -6,7 +6,7 @@ use metaclass; use Moose::Util::TypeConstraints (); -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; diff --git a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm index 517e999..58734d7 100644 --- a/lib/Moose/Meta/TypeConstraint/Parameterizable.pm +++ b/lib/Moose/Meta/TypeConstraint/Parameterizable.pm @@ -4,7 +4,7 @@ use strict; use warnings; use metaclass; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; diff --git a/lib/Moose/Meta/TypeConstraint/Parameterized.pm b/lib/Moose/Meta/TypeConstraint/Parameterized.pm index 680b6dc..e71881c 100644 --- a/lib/Moose/Meta/TypeConstraint/Parameterized.pm +++ b/lib/Moose/Meta/TypeConstraint/Parameterized.pm @@ -8,7 +8,7 @@ use Scalar::Util 'blessed'; use Carp 'confess'; use Moose::Util::TypeConstraints; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; diff --git a/lib/Moose/Meta/TypeConstraint/Registry.pm b/lib/Moose/Meta/TypeConstraint/Registry.pm index 8791d97..f316c81 100644 --- a/lib/Moose/Meta/TypeConstraint/Registry.pm +++ b/lib/Moose/Meta/TypeConstraint/Registry.pm @@ -8,7 +8,7 @@ use metaclass; use Scalar::Util 'blessed'; use Carp 'confess'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Object'; diff --git a/lib/Moose/Meta/TypeConstraint/Role.pm b/lib/Moose/Meta/TypeConstraint/Role.pm index 5ae68f7..8bc111f 100644 --- a/lib/Moose/Meta/TypeConstraint/Role.pm +++ b/lib/Moose/Meta/TypeConstraint/Role.pm @@ -7,7 +7,7 @@ use metaclass; use Scalar::Util 'blessed'; use Moose::Util::TypeConstraints (); -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; diff --git a/lib/Moose/Meta/TypeConstraint/Union.pm b/lib/Moose/Meta/TypeConstraint/Union.pm index e4f7c22..ba0c088 100644 --- a/lib/Moose/Meta/TypeConstraint/Union.pm +++ b/lib/Moose/Meta/TypeConstraint/Union.pm @@ -7,7 +7,7 @@ use metaclass; use Moose::Meta::TypeCoercion::Union; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::TypeConstraint'; diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 86dce7f..cb51e6d 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -9,7 +9,7 @@ use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class'; use Carp 'confess'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; sub new { diff --git a/lib/Moose/Role.pm b/lib/Moose/Role.pm index 44f8c86..7e98c4a 100644 --- a/lib/Moose/Role.pm +++ b/lib/Moose/Role.pm @@ -10,7 +10,7 @@ use Carp 'confess', 'croak'; use Data::OptList; use Sub::Exporter; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; use Moose (); diff --git a/lib/Moose/Util.pm b/lib/Moose/Util.pm index 41f6bcb..0812832 100644 --- a/lib/Moose/Util.pm +++ b/lib/Moose/Util.pm @@ -8,7 +8,7 @@ use Scalar::Util 'blessed'; use Carp 'confess'; use Class::MOP 0.56; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; my @exports = qw[ diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index b2315b2..6434caf 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -8,7 +8,7 @@ use Carp 'confess'; use Scalar::Util 'blessed'; use Sub::Exporter; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; ## -------------------------------------------------------- diff --git a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm index bd8c927..27a75d6 100644 --- a/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm +++ b/lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm @@ -5,7 +5,7 @@ use warnings; use Scalar::Util 'blessed', 'looks_like_number'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; sub Value { defined($_[0]) && !ref($_[0]) } diff --git a/lib/Test/Moose.pm b/lib/Test/Moose.pm index 871d477..a60df70 100644 --- a/lib/Test/Moose.pm +++ b/lib/Test/Moose.pm @@ -8,7 +8,7 @@ use Test::Builder; use Moose::Util 'does_role', 'find_meta'; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; my @exports = qw[ diff --git a/lib/oose.pm b/lib/oose.pm index 87dc5c0..b9bdb6f 100644 --- a/lib/oose.pm +++ b/lib/oose.pm @@ -5,7 +5,7 @@ use warnings; use Class::MOP; -our $VERSION = '0.54'; +our $VERSION = '0.55'; our $AUTHORITY = 'cpan:STEVAN'; BEGIN {