summaryrefslogtreecommitdiff
path: root/benchmarks/cmop/lib/Bench/Construct.pm
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/cmop/lib/Bench/Construct.pm')
-rw-r--r--benchmarks/cmop/lib/Bench/Construct.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/benchmarks/cmop/lib/Bench/Construct.pm b/benchmarks/cmop/lib/Bench/Construct.pm
new file mode 100644
index 0000000..c290304
--- /dev/null
+++ b/benchmarks/cmop/lib/Bench/Construct.pm
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+package Bench::Construct;
+use Moose;
+use Moose::Util::TypeConstraints;
+
+has class => (
+ isa => "Str",
+ is => "ro",
+);
+
+eval {
+coerce ArrayRef
+ => from HashRef
+ => via { [ %$_ ] };
+};
+
+has args => (
+ isa => "ArrayRef",
+ is => "ro",
+ auto_deref => 1,
+ coerce => 1,
+);
+
+sub code {
+ my $self = shift;
+
+ my $class = $self->class;
+ my @args = $self->args;
+
+ sub { my $obj = $class->new( @args ) }
+}
+
+__PACKAGE__;
+
+__END__