From: Stevan Little Date: Thu, 22 Oct 2009 18:12:36 +0000 (-0400) Subject: filling in more stubs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fabandoned%2Frequires_attr_and_co;p=gitmo%2FMoose.git filling in more stubs --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 270f4ba..fdb456a 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -218,10 +218,18 @@ sub add_required_methods { sub add_required_attributes { my $self = shift; + for (@_) { + my $attr_name = $_; + $self->get_required_attributes_map->{$attr_name} = $attr_name; + } } sub add_required_class { my $self = shift; + for (@_) { + my $class_name = $_; + $self->get_required_classes_map->{$class_name} = $class_name; + } } sub add_conflicting_method { diff --git a/lib/Moose/Meta/Role/Application.pm b/lib/Moose/Meta/Role/Application.pm index 8c45eb6..f032ee6 100644 --- a/lib/Moose/Meta/Role/Application.pm +++ b/lib/Moose/Meta/Role/Application.pm @@ -68,6 +68,7 @@ sub apply { $self->check_role_exclusions(@_); $self->check_required_methods(@_); $self->check_required_attributes(@_); + $self->check_required_classes(@_); $self->apply_attributes(@_); $self->apply_methods(@_); @@ -82,6 +83,7 @@ sub apply { sub check_role_exclusions { Carp::croak "Abstract Method" } sub check_required_methods { Carp::croak "Abstract Method" } sub check_required_attributes { Carp::croak "Abstract Method" } +sub check_required_classes { Carp::croak "Abstract Method" } sub apply_attributes { Carp::croak "Abstract Method" } sub apply_methods { Carp::croak "Abstract Method" } diff --git a/lib/Moose/Meta/Role/Application/RoleSummation.pm b/lib/Moose/Meta/Role/Application/RoleSummation.pm index 312b47c..6ddbd57 100644 --- a/lib/Moose/Meta/Role/Application/RoleSummation.pm +++ b/lib/Moose/Meta/Role/Application/RoleSummation.pm @@ -113,6 +113,10 @@ sub check_required_attributes { } +sub check_required_classes { + +} + sub apply_attributes { my ($self, $c) = @_; diff --git a/lib/Moose/Meta/Role/Application/ToClass.pm b/lib/Moose/Meta/Role/Application/ToClass.pm index 79780bd..fcccd48 100644 --- a/lib/Moose/Meta/Role/Application/ToClass.pm +++ b/lib/Moose/Meta/Role/Application/ToClass.pm @@ -127,6 +127,10 @@ sub check_required_attributes { } +sub check_required_classes { + +} + sub apply_attributes { my ($self, $role, $class) = @_; foreach my $attribute_name ($role->get_attribute_list) { diff --git a/lib/Moose/Meta/Role/Application/ToRole.pm b/lib/Moose/Meta/Role/Application/ToRole.pm index 49ca840..30675e1 100644 --- a/lib/Moose/Meta/Role/Application/ToRole.pm +++ b/lib/Moose/Meta/Role/Application/ToRole.pm @@ -49,6 +49,10 @@ sub check_required_attributes { } +sub check_required_classes { + +} + sub apply_attributes { my ($self, $role1, $role2) = @_; foreach my $attribute_name ($role1->get_attribute_list) {