Commit | Line | Data |
38bf2a25 |
1 | #!/usr/bin/perl |
2 | |
3 | package Bench::Construct; |
4 | use Moose; |
5 | use Moose::Util::TypeConstraints; |
6 | |
7 | has class => ( |
8 | isa => "Str", |
9 | is => "ro", |
10 | ); |
11 | |
12 | eval { |
13 | coerce ArrayRef |
14 | => from HashRef |
15 | => via { [ %$_ ] }; |
16 | }; |
17 | |
18 | has args => ( |
19 | isa => "ArrayRef", |
20 | is => "ro", |
21 | auto_deref => 1, |
22 | coerce => 1, |
23 | ); |
24 | |
25 | sub code { |
26 | my $self = shift; |
27 | |
28 | my $class = $self->class; |
29 | my @args = $self->args; |
30 | |
31 | sub { my $obj = $class->new( @args ) } |
32 | } |
33 | |
34 | __PACKAGE__; |
35 | |
36 | __END__ |