$self->get_attribute_map->{$name} = $attr_desc;
}
-sub _clean_up_required_methods {
- my $self = shift;
- foreach my $method ($self->get_required_method_list) {
- $self->remove_required_methods($method)
- if $self->has_method($method);
- }
-}
+# DEPRECATED
+# sub _clean_up_required_methods {
+# my $self = shift;
+# foreach my $method ($self->get_required_method_list) {
+# $self->remove_required_methods($method)
+# if $self->has_method($method);
+# }
+# }
## ------------------------------------------------------------------
## method modifiers
## ------------------------------------------------------------------
sub apply {
- my ($self, $other) = @_;
-
+ my ($self, $other, @args) = @_;
+
+ (blessed($other))
+ || confess "You must pass in an blessed instance";
+
if ($other->isa('Moose::Meta::Role')) {
require Moose::Meta::Role::Application::ToRole;
- return Moose::Meta::Role::Application::ToRole->new->apply($self, $other);
+ return Moose::Meta::Role::Application::ToRole->new->apply($self, $other, @args);
}
elsif ($other->isa('Moose::Meta::Class')) {
require Moose::Meta::Role::Application::ToClass;
- return Moose::Meta::Role::Application::ToClass->new->apply($self, $other);
+ return Moose::Meta::Role::Application::ToClass->new->apply($self, $other, @args);
}
else {
require Moose::Meta::Role::Application::ToInstance;
- return Moose::Meta::Role::Application::ToInstance->new->apply($self, $other);
+ return Moose::Meta::Role::Application::ToInstance->new->apply($self, $other, @args);
}
}
sub apply_methods { die "Abstract Method" }
sub apply_override_method_modifiers { die "Abstract Method" }
sub apply_method_modifiers { die "Abstract Method" }
-sub apply_before_method_modifiers { die "Abstract Method" }
-sub apply_around_method_modifiers { die "Abstract Method" }
-sub apply_after_method_modifiers { die "Abstract Method" }
+
+sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) }
+sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) }
+sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) }
1;
}
}
-sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) }
-sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) }
-sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) }
-
1;
__END__
=item B<apply_method_modifiers>
-=item B<apply_before_method_modifiers>
-
-=item B<apply_after_method_modifiers>
-
-=item B<apply_around_method_modifiers>
-
=item B<apply_override_method_modifiers>
=back
}
}
-sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) }
-sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) }
-sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) }
-
1;
__END__
=item B<apply_method_modifiers>
-=item B<apply_before_method_modifiers>
-
-=item B<apply_after_method_modifiers>
-
-=item B<apply_around_method_modifiers>
-
=item B<apply_override_method_modifiers>
=back
}
}
-sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) }
-sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) }
-sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) }
-
1;
=item B<apply_method_modifiers>
-=item B<apply_before_method_modifiers>
-
-=item B<apply_after_method_modifiers>
-
-=item B<apply_around_method_modifiers>
-
=item B<apply_override_method_modifiers>
=back
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More no_plan => 1;
+use Test::Exception;
+
+BEGIN {
+ use_ok('Moose');
+}
+
+=pod
+
+{
+ package Scalar;
+ use Moose::Role;
+
+ BEGIN { parameter T => { isa => 'Moose::Meta::TypeConstraint' } };
+
+ has 'val' => (is => 'ro', isa => T);
+
+ requires 'eq';
+
+ sub not_eq { ! (shift)->eq(shift) }
+}
+
+is_deeply(
+ Scalar->meta->parameters,
+ { T => { isa => 'Moose::Meta::TypeConstraint' } },
+ '... got the right parameters in the role'
+);
+
+{
+ package Integers;
+ use Moose;
+ use Moose::Util::TypeConstraints;
+
+ with Scalar => { T => find_type_constraint('Int') };
+
+ sub eq { shift == shift }
+}
+
+=cut
+