$self->parameter_metaclass->add_attribute(@_);
}
+sub construct_parameters {
+ my $self = shift;
+ $self->parameter_metaclass->construct_instance(@_);
+}
+
__PACKAGE__->meta->make_immutable;
no Moose;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More tests => 7;
use Test::Exception;
use MooseX::Role::Parameterized::Parameters;
is($parameter->name, 'length', "parameter name");
ok($parameter->is_required, "parameter is required");
+throws_ok {
+ MyRole::LengthParameter->meta->construct_parameters;
+} qr/^Attribute \(length\) is required/;
+
+$p = MyRole::LengthParameter->meta->construct_parameters(
+ length => 5,
+);
+
+is($p->length, 5, "correct length");