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