From: Shawn M Moore Date: Sun, 3 May 2009 18:37:13 +0000 (-0400) Subject: Have Moose::Meta::Role::Application::ToClass track the class and role X-Git-Tag: 0.78~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff9c4953b4d4b024482f4021c036052b2a9b7547;p=gitmo%2FMoose.git Have Moose::Meta::Role::Application::ToClass track the class and role --- diff --git a/lib/Moose/Meta/Role/Application/ToClass.pm b/lib/Moose/Meta/Role/Application/ToClass.pm index 4c5221c..28d1ef4 100644 --- a/lib/Moose/Meta/Role/Application/ToClass.pm +++ b/lib/Moose/Meta/Role/Application/ToClass.pm @@ -13,8 +13,22 @@ our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Role::Application'; +__PACKAGE__->meta->add_attribute('role' => ( + reader => 'role', + writer => 'set_role', +)); + +__PACKAGE__->meta->add_attribute('class' => ( + reader => 'class', + writer => 'set_class', +)); + sub apply { my ($self, $role, $class) = @_; + + $self->set_role($role); + $self->set_class($class); + $self->SUPER::apply($role, $class); $class->add_role($role); }