3 use Benchmark qw(:all);
4 use Config; printf "Perl/%vd in $Config{archname}\n\n", $^V;
8 my $cxsa_is_loaded = eval q{
21 sub new { bless {}, shift }
40 has with_tc_class_type => (
45 has with_tc_array_of_int => (
47 isa => 'ArrayRef[Int]',
49 __PACKAGE__->meta->make_immutable;
66 has with_tc_class_type => (
70 has with_tc_array_of_int => (
72 isa => 'ArrayRef[Int]',
75 __PACKAGE__->meta->make_immutable;
78 use B qw(svref_2object);
80 print "Moose/$Moose::VERSION (Class::MOP/$Class::MOP::VERSION)\n";
81 print "Mouse/$Mouse::VERSION\n";
82 print "Class::XSAccessor/$Class::XSAccessor::VERSION\n" if $cxsa_is_loaded;
84 my $mi = MouseOne->new();
85 my $mx = MooseOne->new();
87 $cx = CXSA->new if $cxsa_is_loaded;
89 print "\nSETTING for simple attributes\n";
100 'C::XSAccessor' => sub{
108 print "\nSETTING for attributes with type constraints 'Int' (except for C::XSAccessor)\n";
119 'C::XSAccessor' => sub{
126 print "\nSETTING for attributes with type constraints 'Foo' (except for C::XSAccessor)\n";
130 $mi->with_tc_class_type($foo);
131 $mi->with_tc_class_type($foo);
134 $mx->with_tc_class_type($foo);
135 $mx->with_tc_class_type($foo);
138 'C::XSAccessor' => sub{
145 print "\nSETTING for attributes with type constraints 'ArrayRef[Int]' (except for C::XSAccessor)\n";
150 $mi->with_tc_array_of_int($foo);
151 $mi->with_tc_array_of_int($foo);
154 $mx->with_tc_array_of_int($foo);
155 $mx->with_tc_array_of_int($foo);
158 'C::XSAccessor' => sub{