7 sub new { bless {} => shift }
17 package CMMChild::Before;
18 use Class::Method::Modifiers;
19 use base 'PlainParent';
21 before method => sub { "B" };
26 extends 'MooseParent';
28 before method => sub { "B" };
32 package CMMChild::Around;
33 use Class::Method::Modifiers;
34 use base 'PlainParent';
36 around method => sub { shift->() . "A" };
41 extends 'MooseParent';
43 around method => sub { shift->() . "A" };
47 package CMMChild::AllThree;
48 use Class::Method::Modifiers;
49 use base 'PlainParent';
51 before method => sub { "B" };
52 around method => sub { shift->() . "A" };
53 after method => sub { "Z" };
56 package MooseAllThree;
58 extends 'MooseParent';
60 before method => sub { "B" };
61 around method => sub { shift->() . "A" };
62 after method => sub { "Z" };
65 use Benchmark qw(cmpthese);
66 use Benchmark ':hireswallclock';
70 my $cmm_before = CMMChild::Before->new();
71 my $cmm_around = CMMChild::Around->new();
72 my $cmm_allthree = CMMChild::AllThree->new();
74 my $moose_before = MooseBefore->new();
75 my $moose_around = MooseAround->new();
76 my $moose_allthree = MooseAllThree->new();
80 Moose => sub { $moose_before->method() },
81 ClassMethodModifiers => sub { $cmm_before->method() },
86 Moose => sub { $moose_around->method() },
87 ClassMethodModifiers => sub { $cmm_around->method() },
90 print "\nALL THREE\n";
92 Moose => sub { $moose_allthree->method() },
93 ClassMethodModifiers => sub { $cmm_allthree->method() },