4 use Benchmark qw/cmpthese/;
7 for my $klass (qw/Moose Mouse/) {
11 use ${klass}::Util::TypeConstraints;
13 subtype 'NaturalNumber', as 'Int', where { \$_ > 0 };
15 coerce 'NaturalNumber',
16 from 'Str', via { 42 },
21 isa => 'NaturalNumber',
25 __PACKAGE__->meta->make_immutable;
30 print "Class::MOP: $Class::MOP::VERSION\n";
31 print "Moose: $Moose::VERSION\n";
32 print "Mouse: $Mouse::VERSION\n";
36 map { my $x = $_; $_ => sub { $x->new(n => 'foo') } }
42 print "---- new,set\n";
45 map { my $y = $_; $_ => sub { $y->new(n => 'foo')->n('bar') } }
52 my %c = map { $_ => "${_}One"->new(n => 'foo') } qw/Moose Mouse/;
55 map { my $y = $_; $_ => sub { $c{$y}->n('bar') } }