6 use Scalar::Util 'blessed';
7 use Benchmark qw[cmpthese];
9 use Moose::Util::TypeConstraints;
14 Foo->meta->make_immutable(debug => 0);
19 => via { Foo->new(@{$_}) };
25 has 'default' => (is => 'rw', default => 10);
26 has 'default_sub' => (is => 'rw', default => sub { [] });
27 has 'lazy' => (is => 'rw', default => 10, lazy => 1);
28 has 'required' => (is => 'rw', required => 1);
29 has 'weak_ref' => (is => 'rw', weak_ref => 1);
30 has 'type_constraint' => (is => 'rw', isa => 'Foo');
31 has 'coercion' => (is => 'rw', isa => 'Foo', coerce => 1);
36 package Foo::Immutable;
39 has 'default' => (is => 'rw', default => 10);
40 has 'default_sub' => (is => 'rw', default => sub { [] });
41 has 'lazy' => (is => 'rw', default => 10, lazy => 1);
42 has 'required' => (is => 'rw', required => 1);
43 has 'weak_ref' => (is => 'rw', weak_ref => 1);
44 has 'type_constraint' => (is => 'rw', isa => 'Foo');
45 has 'coercion' => (is => 'rw', isa => 'Foo', coerce => 1);
51 Foo::Immutable->meta->make_immutable(debug => 1);
63 type_constraint => $foo,
71 type_constraint => $foo,