Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / benchmarks / simple_constructor.pl
CommitLineData
c8cf9aaa 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6my $num_iterations = shift || 100;
7
8{
9 package Foo;
10 use Moose;
11
12 has 'default' => (is => 'rw', default => 10);
d03bd989 13 has 'default_sub' => (is => 'rw', default => sub { [] });
c8cf9aaa 14 has 'lazy' => (is => 'rw', default => 10, lazy => 1);
d03bd989 15 has 'required' => (is => 'rw', required => 1);
16 has 'weak_ref' => (is => 'rw', weak_ref => 1);
17 has 'type_constraint' => (is => 'rw', isa => 'ArrayRef');
c8cf9aaa 18}
19
20foreach (0 .. $num_iterations) {
21 my $foo = Foo->new(
22 required => 'BAR',
23 type_constraint => [],
24 weak_ref => {},
25 );
26}