use Scalar::Util 'blessed', 'weaken';
use overload ();
-our $VERSION = '0.60';
+our $VERSION = '0.61';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Method::Accessor;
return;
}
+sub remove_accessors {
+ my $self = shift;
+ $self->SUPER::remove_accessors(@_);
+ $self->remove_delegation if $self->has_handles;
+ return;
+}
+
sub install_delegation {
my $self = shift;
}
}
+sub remove_delegation {
+ my $self = shift;
+ my %handles = $self->_canonicalize_handles;
+ my $associated_class = $self->associated_class;
+ foreach my $handle (keys %handles) {
+ $self->associated_class->remove_method($handle);
+ }
+}
+
# private methods to help delegation ...
sub _canonicalize_handles {
}
}
else {
+ Class::MOP::load_class($handles)
+ unless Class::MOP::is_class_loaded($handles);
+
my $role_meta = eval { $handles->meta };
if ($@) {
$self->throw_error("Unable to canonicalize the 'handles' option with $handles because : $@", data => $handles, error => $@);
(blessed $role_meta && $role_meta->isa('Moose::Meta::Role'))
|| $self->throw_error("Unable to canonicalize the 'handles' option with $handles because ->meta is not a Moose::Meta::Role", data => $handles);
-
+
return map { $_ => $_ } (
$role_meta->get_method_list,
$role_meta->get_required_method_list
=item B<install_accessors>
+=item B<remove_accessors>
+
=item B<install_delegation>
+=item B<remove_delegation>
+
=item B<accessor_metaclass>
=item B<get_value>