From: Shawn M Moore Date: Sun, 9 Nov 2008 03:02:19 +0000 (+0000) Subject: We want a parameter_metaclass attribute; each role application will get an instance... X-Git-Tag: 0.05~110 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f563c3cda3fd8ce578f666294f4ca236e4c92505;p=gitmo%2FMooseX-Role-Parameterized.git We want a parameter_metaclass attribute; each role application will get an instance of the class it describes --- diff --git a/lib/MooseX/Role/Parameterized/Meta/Role.pm b/lib/MooseX/Role/Parameterized/Meta/Role.pm index 60c6eb7..0ff6186 100644 --- a/lib/MooseX/Role/Parameterized/Meta/Role.pm +++ b/lib/MooseX/Role/Parameterized/Meta/Role.pm @@ -5,7 +5,21 @@ extends 'Moose::Meta::Role'; use MooseX::Role::Parameterized::Parameters; -sub parameter_class { 'MooseX::Role::Parameterized::Parameters' } +has parameter_metaclass => ( + is => 'ro', + isa => 'Moose::Meta::Class', + lazy => 1, + default => sub { + Moose::Meta::Class->create_anon_class( + superclasses => ['MooseX::Role::Parameterized::Parameters'], + ); + }, +); + +sub add_parameter { + my $self = shift; + $self->parameter_metaclass->add_attribute(@_); +} __PACKAGE__->meta->make_immutable; no Moose;