Commit | Line | Data |
---|---|---|
b07c7a9d | 1 | #!/usr/bin/perl |
2 | ||
3 | package Bench::Construct; | |
4 | use Moose; | |
5b2d23f3 | 5 | use Moose::Util::TypeConstraints; |
b07c7a9d | 6 | |
7 | has class => ( | |
8 | isa => "Str", | |
9 | is => "ro", | |
10 | ); | |
11 | ||
5b2d23f3 | 12 | eval { |
13 | coerce ArrayRef | |
14 | => from HashRef | |
15 | => via { [ %$_ ] }; | |
16 | }; | |
17 | ||
b07c7a9d | 18 | has args => ( |
19 | isa => "ArrayRef", | |
20 | is => "ro", | |
21 | auto_deref => 1, | |
5b2d23f3 | 22 | coerce => 1, |
b07c7a9d | 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__ |