Improve is_class_loaded checking
[gitmo/Class-MOP.git] / bench / lib / Bench / Construct.pm
CommitLineData
b07c7a9d 1#!/usr/bin/perl
2
3package Bench::Construct;
4use Moose;
5b2d23f3 5use Moose::Util::TypeConstraints;
b07c7a9d 6
7has class => (
8 isa => "Str",
9 is => "ro",
10);
11
5b2d23f3 12eval {
13coerce ArrayRef
14 => from HashRef
15 => via { [ %$_ ] };
16};
17
b07c7a9d 18has args => (
19 isa => "ArrayRef",
20 is => "ro",
21 auto_deref => 1,
5b2d23f3 22 coerce => 1,
b07c7a9d 23);
24
25sub 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__