← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:23:28 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Accessor.pm
StatementsExecuted 4835 statements in 15.1ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
197224.38ms47.5msClass::MOP::Method::Accessor::::newClass::MOP::Method::Accessor::new
254333.53ms7.28msClass::MOP::Method::Accessor::::_newClass::MOP::Method::Accessor::_new
197111.93ms36.8msClass::MOP::Method::Accessor::::_initialize_bodyClass::MOP::Method::Accessor::_initialize_body
5622694µs16.2msClass::MOP::Method::Accessor::::_generate_reader_method_inlineClass::MOP::Method::Accessor::_generate_reader_method_inline
5611640µs14.6msClass::MOP::Method::Accessor::::__ANON__[:154]Class::MOP::Method::Accessor::__ANON__[:154]
2822414µs13.8msClass::MOP::Method::Accessor::::_generate_accessor_method_inlineClass::MOP::Method::Accessor::_generate_accessor_method_inline
5311332µs387µsClass::MOP::Method::Accessor::::_generate_reader_methodClass::MOP::Method::Accessor::_generate_reader_method
2811328µs12.9msClass::MOP::Method::Accessor::::__ANON__[:120]Class::MOP::Method::Accessor::__ANON__[:120]
1611188µs2.97msClass::MOP::Method::Accessor::::_generate_predicate_method_inlineClass::MOP::Method::Accessor::_generate_predicate_method_inline
2211140µs163µsClass::MOP::Method::Accessor::::_generate_accessor_methodClass::MOP::Method::Accessor::_generate_accessor_method
1611119µs2.54msClass::MOP::Method::Accessor::::__ANON__[:209]Class::MOP::Method::Accessor::__ANON__[:209]
5311106µs106µsClass::MOP::Method::Accessor::::_inline_throw_errorClass::MOP::Method::Accessor::_inline_throw_error
161195µs109µsClass::MOP::Method::Accessor::::_generate_predicate_methodClass::MOP::Method::Accessor::_generate_predicate_method
31140µs564µsClass::MOP::Method::Accessor::::_generate_writer_method_inlineClass::MOP::Method::Accessor::_generate_writer_method_inline
31125µs480µsClass::MOP::Method::Accessor::::__ANON__[:184]Class::MOP::Method::Accessor::__ANON__[:184]
31121µs24µsClass::MOP::Method::Accessor::::_generate_writer_methodClass::MOP::Method::Accessor::_generate_writer_method
1118µs4.62msClass::MOP::Method::Accessor::::BEGIN@17Class::MOP::Method::Accessor::BEGIN@17
1118µs8µsClass::MOP::Method::Accessor::::BEGIN@3Class::MOP::Method::Accessor::BEGIN@3
1117µs44µsClass::MOP::Method::Accessor::::BEGIN@15Class::MOP::Method::Accessor::BEGIN@15
1117µs18µsClass::MOP::Method::Accessor::::BEGIN@11Class::MOP::Method::Accessor::BEGIN@11
1117µs10µsClass::MOP::Method::Accessor::::BEGIN@10Class::MOP::Method::Accessor::BEGIN@10
1116µs28µsClass::MOP::Method::Accessor::::BEGIN@13Class::MOP::Method::Accessor::BEGIN@13
1116µs30µsClass::MOP::Method::Accessor::::BEGIN@14Class::MOP::Method::Accessor::BEGIN@14
0000s0sClass::MOP::Method::Accessor::::__ANON__[:104]Class::MOP::Method::Accessor::__ANON__[:104]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:123]Class::MOP::Method::Accessor::__ANON__[:123]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:134]Class::MOP::Method::Accessor::__ANON__[:134]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:157]Class::MOP::Method::Accessor::__ANON__[:157]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:171]Class::MOP::Method::Accessor::__ANON__[:171]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:187]Class::MOP::Method::Accessor::__ANON__[:187]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:196]Class::MOP::Method::Accessor::__ANON__[:196]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:212]Class::MOP::Method::Accessor::__ANON__[:212]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:221]Class::MOP::Method::Accessor::__ANON__[:221]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:234]Class::MOP::Method::Accessor::__ANON__[:234]
0000s0sClass::MOP::Method::Accessor::::__ANON__[:237]Class::MOP::Method::Accessor::__ANON__[:237]
0000s0sClass::MOP::Method::Accessor::::_generate_clearer_methodClass::MOP::Method::Accessor::_generate_clearer_method
0000s0sClass::MOP::Method::Accessor::::_generate_clearer_method_inlineClass::MOP::Method::Accessor::_generate_clearer_method_inline
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package Class::MOP::Method::Accessor;
3
# spent 8µs within Class::MOP::Method::Accessor::BEGIN@3 which was called: # once (8µs+0s) by Class::MOP::Class::BEGIN@15 at line 5
BEGIN {
415µs $Class::MOP::Method::Accessor::AUTHORITY = 'cpan:STEVAN';
5121µs18µs}
# spent 8µs making 1 call to Class::MOP::Method::Accessor::BEGIN@3
6{
722µs $Class::MOP::Method::Accessor::VERSION = '2.0602';
8}
9
10320µs212µs
# spent 10µs (7+2) within Class::MOP::Method::Accessor::BEGIN@10 which was called: # once (7µs+2µs) by Class::MOP::Class::BEGIN@15 at line 10
use strict;
# spent 10µs making 1 call to Class::MOP::Method::Accessor::BEGIN@10 # spent 2µs making 1 call to strict::import
11318µs228µs
# spent 18µs (7+10) within Class::MOP::Method::Accessor::BEGIN@11 which was called: # once (7µs+10µs) by Class::MOP::Class::BEGIN@15 at line 11
use warnings;
# spent 18µs making 1 call to Class::MOP::Method::Accessor::BEGIN@11 # spent 10µs making 1 call to warnings::import
12
13319µs250µs
# spent 28µs (6+22) within Class::MOP::Method::Accessor::BEGIN@13 which was called: # once (6µs+22µs) by Class::MOP::Class::BEGIN@15 at line 13
use Carp 'confess';
# spent 28µs making 1 call to Class::MOP::Method::Accessor::BEGIN@13 # spent 22µs making 1 call to Exporter::import
14316µs254µs
# spent 30µs (6+24) within Class::MOP::Method::Accessor::BEGIN@14 which was called: # once (6µs+24µs) by Class::MOP::Class::BEGIN@15 at line 14
use Scalar::Util 'blessed', 'weaken';
# spent 30µs making 1 call to Class::MOP::Method::Accessor::BEGIN@14 # spent 24µs making 1 call to Exporter::import
15321µs280µs
# spent 44µs (7+37) within Class::MOP::Method::Accessor::BEGIN@15 which was called: # once (7µs+37µs) by Class::MOP::Class::BEGIN@15 at line 15
use Try::Tiny;
# spent 44µs making 1 call to Class::MOP::Method::Accessor::BEGIN@15 # spent 36µs making 1 call to Exporter::import
16
173992µs29.23ms
# spent 4.62ms (8µs+4.61) within Class::MOP::Method::Accessor::BEGIN@17 which was called: # once (8µs+4.61ms) by Class::MOP::Class::BEGIN@15 at line 17
use base 'Class::MOP::Method::Generated';
# spent 4.62ms making 1 call to Class::MOP::Method::Accessor::BEGIN@17 # spent 4.61ms making 1 call to base::import
18
19
# spent 47.5ms (4.38+43.1) within Class::MOP::Method::Accessor::new which was called 197 times, avg 241µs/call: # 188 times (4.06ms+29.2ms) by Class::MOP::Attribute::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Attribute.pm:398] at line 389 of Class/MOP/Attribute.pm, avg 177µs/call # 9 times (313µs+13.9ms) by Class::MOP::Attribute::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Attribute.pm:398] at line 20 of Moose/Meta/Method/Accessor.pm, avg 1.58ms/call
sub new {
2019799µs my $class = shift;
211971.10ms my %options = @_;
22
23197116µs (exists $options{attribute})
24 || confess "You must supply an attribute to construct with";
25
2619789µs (exists $options{accessor_type})
27 || confess "You must supply an accessor_type to construct with";
28
291971.12ms394344µs (blessed($options{attribute}) && $options{attribute}->isa('Class::MOP::Attribute'))
# spent 172µs making 197 calls to UNIVERSAL::isa, avg 876ns/call # spent 172µs making 197 calls to Scalar::Util::blessed, avg 873ns/call
30 || confess "You must supply an attribute which is a 'Class::MOP::Attribute' instance";
31
3219796µs ($options{package_name} && $options{name})
33 || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT";
34
35197366µs1971.90ms my $self = $class->_new(\%options);
# spent 1.88ms making 188 calls to Class::MOP::Method::Accessor::_new, avg 10µs/call # spent 18µs making 9 calls to Moose::Meta::Method::Accessor::_new, avg 2µs/call
36
37 # we don't want this creating
38 # a cycle in the code, if not
39 # needed
40197580µs197219µs weaken($self->{'attribute'});
# spent 219µs making 197 calls to Scalar::Util::weaken, avg 1µs/call
41
42197562µs19736.8ms $self->_initialize_body;
# spent 36.8ms making 197 calls to Class::MOP::Method::Accessor::_initialize_body, avg 187µs/call
43
44197614µs return $self;
45}
46
47
# spent 7.28ms (3.53+3.75) within Class::MOP::Method::Accessor::_new which was called 254 times, avg 29µs/call: # 188 times (1.88ms+0s) by Class::MOP::Method::Accessor::new at line 35, avg 10µs/call # 57 times (1.57ms+0s) by Class::MOP::Method::wrap at line 46 of Class/MOP/Method.pm, avg 27µs/call # 9 times (82µs+3.75ms) by Class::MOP::Method::Accessor::new at line 24 of Moose/Meta/Method/Accessor.pm, avg 426µs/call
sub _new {
48254105µs my $class = shift;
49
50254161µs183.75ms return Class::MOP::Class->initialize($class)->new_object(@_)
# spent 3.20ms making 9 calls to Class::MOP::Class::new_object, avg 355µs/call # spent 555µs making 9 calls to Class::MOP::Class::initialize, avg 62µs/call
51 if $class ne __PACKAGE__;
52
53245143µs my $params = @_ == 1 ? $_[0] : {@_};
54
552453.35ms return bless {
56 # inherited from Class::MOP::Method
57 body => $params->{body},
58 associated_metaclass => $params->{associated_metaclass},
59 package_name => $params->{package_name},
60 name => $params->{name},
61 original_method => $params->{original_method},
62
63 # inherit from Class::MOP::Generated
64 is_inline => $params->{is_inline} || 0,
65 definition_context => $params->{definition_context},
66
67 # defined in this class
68 attribute => $params->{attribute},
69 accessor_type => $params->{accessor_type},
70 } => $class;
71}
72
73## accessors
74
75221545µssub associated_attribute { (shift)->{'attribute'} }
76197422µssub accessor_type { (shift)->{'accessor_type'} }
77
78## factory
79
80
# spent 36.8ms (1.93+34.9) within Class::MOP::Method::Accessor::_initialize_body which was called 197 times, avg 187µs/call: # 197 times (1.93ms+34.9ms) by Class::MOP::Method::Accessor::new at line 42, avg 187µs/call
sub _initialize_body {
8119755µs my $self = shift;
82
83197991µs394395µs my $method_name = join "_" => (
# spent 239µs making 197 calls to Class::MOP::Method::Accessor::accessor_type, avg 1µs/call # spent 156µs making 197 calls to Class::MOP::Method::Generated::is_inline, avg 791ns/call
84 '_generate',
85 $self->accessor_type,
86 'method',
87 ($self->is_inline ? 'inline' : ())
88 );
89
90197820µs19734.5ms $self->{'body'} = $self->$method_name();
# spent 14.3ms making 54 calls to Class::MOP::Method::Accessor::_generate_reader_method_inline, avg 264µs/call # spent 7.09ms making 6 calls to Moose::Meta::Method::Accessor::_generate_accessor_method, avg 1.18ms/call # spent 6.90ms making 22 calls to Class::MOP::Method::Accessor::_generate_accessor_method_inline, avg 314µs/call # spent 2.97ms making 16 calls to Class::MOP::Method::Accessor::_generate_predicate_method_inline, avg 185µs/call # spent 2.00ms making 2 calls to Moose::Meta::Method::Accessor::_generate_reader_method, avg 1.00ms/call # spent 564µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method_inline, avg 188µs/call # spent 387µs making 53 calls to Class::MOP::Method::Accessor::_generate_reader_method, avg 7µs/call # spent 163µs making 22 calls to Class::MOP::Method::Accessor::_generate_accessor_method, avg 7µs/call # spent 109µs making 16 calls to Class::MOP::Method::Accessor::_generate_predicate_method, avg 7µs/call # spent 24µs making 3 calls to Class::MOP::Method::Accessor::_generate_writer_method, avg 8µs/call
91}
92
93## generators
94
95
# spent 163µs (140+23) within Class::MOP::Method::Accessor::_generate_accessor_method which was called 22 times, avg 7µs/call: # 22 times (140µs+23µs) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 7µs/call
sub _generate_accessor_method {
96227µs my $self = shift;
972229µs2223µs my $attr = $self->associated_attribute;
# spent 23µs making 22 calls to Class::MOP::Method::Accessor::associated_attribute, avg 1µs/call
98
99 return sub {
100 if (@_ >= 2) {
101 $attr->set_value($_[0], $_[1]);
102 }
103 $attr->get_value($_[0]);
1042299µs };
105}
106
107
# spent 13.8ms (414µs+13.4) within Class::MOP::Method::Accessor::_generate_accessor_method_inline which was called 28 times, avg 493µs/call: # 22 times (319µs+6.59ms) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 314µs/call # 6 times (96µs+6.81ms) by Moose::Meta::Method::Accessor::_generate_accessor_method at line 74 of Moose/Meta/Method/Accessor.pm, avg 1.15ms/call
sub _generate_accessor_method_inline {
1082813µs my $self = shift;
1092839µs2830µs my $attr = $self->associated_attribute;
# spent 30µs making 28 calls to Class::MOP::Method::Accessor::associated_attribute, avg 1µs/call
110
111
# spent 12.9ms (328µs+12.6) within Class::MOP::Method::Accessor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Accessor.pm:120] which was called 28 times, avg 461µs/call: # 28 times (328µs+12.6ms) by Try::Tiny::try at line 71 of Try/Tiny.pm, avg 461µs/call
return try {
11228246µs8412.6ms $self->_compile_code([
# spent 3.71ms making 22 calls to Class::MOP::Method::Generated::_compile_code, avg 169µs/call # spent 3.09ms making 6 calls to Moose::Meta::Attribute::_inline_set_value, avg 514µs/call # spent 2.83ms making 6 calls to Moose::Meta::Method::Accessor::_compile_code, avg 472µs/call # spent 1.83ms making 22 calls to Class::MOP::Attribute::_inline_set_value, avg 83µs/call # spent 668µs making 6 calls to Moose::Meta::Attribute::_inline_get_value, avg 111µs/call # spent 447µs making 22 calls to Class::MOP::Attribute::_inline_get_value, avg 20µs/call
113 'sub {',
114 'if (@_ > 1) {',
115 $attr->_inline_set_value('$_[0]', '$_[1]'),
116 '}',
117 $attr->_inline_get_value('$_[0]'),
118 '}',
119 ]);
120 }
121 catch {
122 confess "Could not generate inline accessor because : $_";
12328244µs5668µs };
# spent 68µs making 28 calls to Try::Tiny::catch, avg 2µs/call # spent 13.3ms making 28 calls to Try::Tiny::try, avg 475µs/call, recursion: max depth 2, sum of overlapping time 13.3ms
124}
125
126
# spent 387µs (332+55) within Class::MOP::Method::Accessor::_generate_reader_method which was called 53 times, avg 7µs/call: # 53 times (332µs+55µs) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 7µs/call
sub _generate_reader_method {
1275314µs my $self = shift;
1285366µs5355µs my $attr = $self->associated_attribute;
# spent 55µs making 53 calls to Class::MOP::Method::Accessor::associated_attribute, avg 1µs/call
129
130 return sub {
131126µs confess "Cannot assign a value to a read-only accessor"
132 if @_ > 1;
1331246µs12339µs $attr->get_value($_[0]);
# spent 339µs making 12 calls to Class::MOP::Attribute::get_value, avg 28µs/call
13453237µs };
135}
136
137
# spent 16.2ms (694µs+15.5) within Class::MOP::Method::Accessor::_generate_reader_method_inline which was called 56 times, avg 289µs/call: # 54 times (642µs+13.6ms) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 264µs/call # 2 times (52µs+1.88ms) by Moose::Meta::Method::Accessor::_generate_reader_method at line 62 of Moose/Meta/Method/Accessor.pm, avg 967µs/call
sub _generate_reader_method_inline {
1385624µs my $self = shift;
1395671µs5658µs my $attr = $self->associated_attribute;
# spent 58µs making 56 calls to Class::MOP::Method::Accessor::associated_attribute, avg 1µs/call
140
141
# spent 14.6ms (640µs+14.0) within Class::MOP::Method::Accessor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Accessor.pm:154] which was called 56 times, avg 261µs/call: # 56 times (640µs+14.0ms) by Try::Tiny::try at line 71 of Try/Tiny.pm, avg 261µs/call
return try {
14256444µs16814.0ms $self->_compile_code([
# spent 8.35ms making 53 calls to Class::MOP::Method::Generated::_compile_code, avg 158µs/call # spent 3.00ms making 53 calls to Class::MOP::Attribute::_inline_get_value, avg 57µs/call # spent 1.19ms making 3 calls to Moose::Meta::Method::Accessor::_compile_code, avg 398µs/call # spent 722µs making 3 calls to Moose::Meta::Method::_inline_throw_error, avg 241µs/call # spent 583µs making 3 calls to Moose::Meta::Attribute::_inline_get_value, avg 194µs/call # spent 106µs making 53 calls to Class::MOP::Method::Accessor::_inline_throw_error, avg 2µs/call
143 'sub {',
144 'if (@_ > 1) {',
145 # XXX: this is a hack, but our error stuff is terrible
146 $self->_inline_throw_error(
147 '"Cannot assign a value to a read-only accessor"',
148 'data => \@_'
149 ) . ';',
150 '}',
151 $attr->_inline_get_value('$_[0]'),
152 '}',
153 ]);
154 }
155 catch {
156 confess "Could not generate inline reader because : $_";
15756430µs112130µs };
# spent 130µs making 56 calls to Try::Tiny::catch, avg 2µs/call # spent 15.3ms making 56 calls to Try::Tiny::try, avg 273µs/call, recursion: max depth 2, sum of overlapping time 15.3ms
158}
159
160
# spent 106µs within Class::MOP::Method::Accessor::_inline_throw_error which was called 53 times, avg 2µs/call: # 53 times (106µs+0s) by Class::MOP::Method::Accessor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Accessor.pm:154] at line 142, avg 2µs/call
sub _inline_throw_error {
1615320µs my $self = shift;
16253198µs return 'Carp::confess ' . $_[0];
163}
164
165
# spent 24µs (21+3) within Class::MOP::Method::Accessor::_generate_writer_method which was called 3 times, avg 8µs/call: # 3 times (21µs+3µs) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 8µs/call
sub _generate_writer_method {
16632µs my $self = shift;
16734µs33µs my $attr = $self->associated_attribute;
# spent 3µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 867ns/call
168
169 return sub {
170 $attr->set_value($_[0], $_[1]);
171313µs };
172}
173
174
# spent 564µs (40+524) within Class::MOP::Method::Accessor::_generate_writer_method_inline which was called 3 times, avg 188µs/call: # 3 times (40µs+524µs) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 188µs/call
sub _generate_writer_method_inline {
17532µs my $self = shift;
17634µs33µs my $attr = $self->associated_attribute;
# spent 3µs making 3 calls to Class::MOP::Method::Accessor::associated_attribute, avg 900ns/call
177
178
# spent 480µs (25+455) within Class::MOP::Method::Accessor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Accessor.pm:184] which was called 3 times, avg 160µs/call: # 3 times (25µs+455µs) by Try::Tiny::try at line 71 of Try/Tiny.pm, avg 160µs/call
return try {
179321µs6455µs $self->_compile_code([
# spent 375µs making 3 calls to Class::MOP::Method::Generated::_compile_code, avg 125µs/call # spent 79µs making 3 calls to Class::MOP::Attribute::_inline_set_value, avg 26µs/call
180 'sub {',
181 $attr->_inline_set_value('$_[0]', '$_[1]'),
182 '}',
183 ]);
184 }
185 catch {
186 confess "Could not generate inline writer because : $_";
187323µs66µs };
# spent 6µs making 3 calls to Try::Tiny::catch, avg 2µs/call # spent 515µs making 3 calls to Try::Tiny::try, avg 172µs/call, recursion: max depth 1, sum of overlapping time 515µs
188}
189
190
# spent 109µs (95+14) within Class::MOP::Method::Accessor::_generate_predicate_method which was called 16 times, avg 7µs/call: # 16 times (95µs+14µs) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 7µs/call
sub _generate_predicate_method {
191165µs my $self = shift;
1921617µs1614µs my $attr = $self->associated_attribute;
# spent 14µs making 16 calls to Class::MOP::Method::Accessor::associated_attribute, avg 894ns/call
193
194 return sub {
1951254µs12274µs $attr->has_value($_[0])
# spent 274µs making 12 calls to Class::MOP::Attribute::has_value, avg 23µs/call
1961668µs };
197}
198
199
# spent 2.97ms (188µs+2.78) within Class::MOP::Method::Accessor::_generate_predicate_method_inline which was called 16 times, avg 185µs/call: # 16 times (188µs+2.78ms) by Class::MOP::Method::Accessor::_initialize_body at line 90, avg 185µs/call
sub _generate_predicate_method_inline {
200166µs my $self = shift;
2011621µs1617µs my $attr = $self->associated_attribute;
# spent 17µs making 16 calls to Class::MOP::Method::Accessor::associated_attribute, avg 1µs/call
202
203
# spent 2.54ms (119µs+2.42) within Class::MOP::Method::Accessor::__ANON__[/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Class/MOP/Method/Accessor.pm:209] which was called 16 times, avg 159µs/call: # 16 times (119µs+2.42ms) by Try::Tiny::try at line 71 of Try/Tiny.pm, avg 159µs/call
return try {
2041696µs322.42ms $self->_compile_code([
# spent 2.03ms making 16 calls to Class::MOP::Method::Generated::_compile_code, avg 127µs/call # spent 392µs making 16 calls to Class::MOP::Attribute::_inline_has_value, avg 24µs/call
205 'sub {',
206 $attr->_inline_has_value('$_[0]'),
207 '}',
208 ]);
209 }
210 catch {
211 confess "Could not generate inline predicate because : $_";
21216116µs3236µs };
# spent 36µs making 16 calls to Try::Tiny::catch, avg 2µs/call # spent 2.73ms making 16 calls to Try::Tiny::try, avg 170µs/call, recursion: max depth 1, sum of overlapping time 2.73ms
213}
214
215sub _generate_clearer_method {
216 my $self = shift;
217 my $attr = $self->associated_attribute;
218
219 return sub {
220 $attr->clear_value($_[0])
221 };
222}
223
224sub _generate_clearer_method_inline {
225 my $self = shift;
226 my $attr = $self->associated_attribute;
227
228 return try {
229 $self->_compile_code([
230 'sub {',
231 $attr->_inline_clear_value('$_[0]'),
232 '}',
233 ]);
234 }
235 catch {
236 confess "Could not generate inline clearer because : $_";
237 };
238}
239
24015µs1;
241
242# ABSTRACT: Method Meta Object for accessors
243
- -
246=pod
247
248=head1 NAME
249
250Class::MOP::Method::Accessor - Method Meta Object for accessors
251
252=head1 VERSION
253
254version 2.0602
255
256=head1 SYNOPSIS
257
258 use Class::MOP::Method::Accessor;
259
260 my $reader = Class::MOP::Method::Accessor->new(
261 attribute => $attribute,
262 is_inline => 1,
263 accessor_type => 'reader',
264 );
265
266 $reader->body->execute($instance); # call the reader method
267
268=head1 DESCRIPTION
269
270This is a subclass of C<Class::MOP::Method> which is used by
271C<Class::MOP::Attribute> to generate accessor code. It handles
272generation of readers, writers, predicates and clearers. For each type
273of method, it can either create a subroutine reference, or actually
274inline code by generating a string and C<eval>'ing it.
275
276=head1 METHODS
277
278=over 4
279
280=item B<< Class::MOP::Method::Accessor->new(%options) >>
281
282This returns a new C<Class::MOP::Method::Accessor> based on the
283C<%options> provided.
284
285=over 4
286
287=item * attribute
288
289This is the C<Class::MOP::Attribute> for which accessors are being
290generated. This option is required.
291
292=item * accessor_type
293
294This is a string which should be one of "reader", "writer",
295"accessor", "predicate", or "clearer". This is the type of method
296being generated. This option is required.
297
298=item * is_inline
299
300This indicates whether or not the accessor should be inlined. This
301defaults to false.
302
303=item * name
304
305The method name (without a package name). This is required.
306
307=item * package_name
308
309The package name for the method. This is required.
310
311=back
312
313=item B<< $metamethod->accessor_type >>
314
315Returns the accessor type which was passed to C<new>.
316
317=item B<< $metamethod->is_inline >>
318
319Returns a boolean indicating whether or not the accessor is inlined.
320
321=item B<< $metamethod->associated_attribute >>
322
323This returns the L<Class::MOP::Attribute> object which was passed to
324C<new>.
325
326=item B<< $metamethod->body >>
327
328The method itself is I<generated> when the accessor object is
329constructed.
330
331=back
332
333=head1 AUTHOR
334
335Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details.
336
337=head1 COPYRIGHT AND LICENSE
338
339This software is copyright (c) 2012 by Infinity Interactive, Inc..
340
341This is free software; you can redistribute it and/or modify it under
342the same terms as the Perl 5 programming language system itself.
343
344=cut
345
346
347__END__