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 extends 'Foo::Normal';
38 has 'default_w_type_constraint' => (
46 package Foo::Immutable;
49 has 'default' => (is => 'rw', default => 10);
50 has 'default_sub' => (is => 'rw', default => sub { [] });
51 has 'lazy' => (is => 'rw', default => 10, lazy => 1);
52 has 'required' => (is => 'rw', required => 1);
53 has 'weak_ref' => (is => 'rw', weak_ref => 1);
54 has 'type_constraint' => (is => 'rw', isa => 'Foo');
55 has 'coercion' => (is => 'rw', isa => 'Foo', coerce => 1);
61 Foo::Immutable->meta->make_immutable(debug => 0);
63 package Bar::Immutable;
66 extends 'Foo::Immutable';
68 has 'default_w_type_constraint' => (
74 Bar::Immutable->meta->make_immutable(debug => 0);
86 type_constraint => $foo,
94 type_constraint => $foo,