File | /usr/local/lib/perl5/site_perl/5.10.1/MooseX/ClassAttribute/Meta/Method/Accessor.pm |
Statements Executed | 31 |
Statement Execution Time | 646µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 45µs | 61µs | _inline_check_lazy | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 34µs | 66µs | _inline_store | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 20µs | 23µs | _inline_get_old_value_for_trigger | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 16µs | 36µs | _inline_get | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 14µs | 16µs | BEGIN@3 | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 10µs | 2.53ms | BEGIN@6 | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 9µs | 126µs | BEGIN@120 | MooseX::ClassAttribute::Meta::Method::Accessor::
1 | 1 | 1 | 7µs | 15µs | BEGIN@4 | MooseX::ClassAttribute::Meta::Method::Accessor::
0 | 0 | 0 | 0s | 0s | _generate_clearer_method_inline | MooseX::ClassAttribute::Meta::Method::Accessor::
0 | 0 | 0 | 0s | 0s | _generate_predicate_method_inline | MooseX::ClassAttribute::Meta::Method::Accessor::
0 | 0 | 0 | 0s | 0s | _inline_access | MooseX::ClassAttribute::Meta::Method::Accessor::
0 | 0 | 0 | 0s | 0s | _inline_has | MooseX::ClassAttribute::Meta::Method::Accessor::
0 | 0 | 0 | 0s | 0s | _inline_init_slot | MooseX::ClassAttribute::Meta::Method::Accessor::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package MooseX::ClassAttribute::Meta::Method::Accessor; | ||||
2 | |||||
3 | 3 | 20µs | 2 | 19µs | # spent 16µs (14+3) within MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@3 which was called
# once (14µs+3µs) by MooseX::ClassAttribute::Role::Meta::Attribute::BEGIN@6 at line 3 # spent 16µs making 1 call to MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@3
# spent 2µs making 1 call to strict::import |
4 | 3 | 29µs | 2 | 24µs | # spent 15µs (7+8) within MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@4 which was called
# once (7µs+8µs) by MooseX::ClassAttribute::Role::Meta::Attribute::BEGIN@6 at line 4 # spent 15µs making 1 call to MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@4
# spent 8µs making 1 call to warnings::import |
5 | |||||
6 | 3 | 439µs | 2 | 5.05ms | # spent 2.53ms (10µs+2.52) within MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@6 which was called
# once (10µs+2.52ms) by MooseX::ClassAttribute::Role::Meta::Attribute::BEGIN@6 at line 6 # spent 2.53ms making 1 call to MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@6
# spent 2.52ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389] |
7 | |||||
8 | 1 | 2µs | 1 | 421µs | extends 'Moose::Meta::Method::Accessor'; # spent 421µs making 1 call to Moose::extends |
9 | |||||
10 | |||||
11 | sub _generate_predicate_method_inline | ||||
12 | { | ||||
13 | my $attr = (shift)->associated_attribute; | ||||
14 | |||||
15 | my $code = | ||||
16 | eval 'sub {' | ||||
17 | . $attr->associated_class()->inline_is_class_slot_initialized( $attr->name() ) | ||||
18 | . '}'; | ||||
19 | |||||
20 | confess "Could not generate inline predicate because : $@" if $@; | ||||
21 | |||||
22 | return $code; | ||||
23 | } | ||||
24 | |||||
25 | sub _generate_clearer_method_inline | ||||
26 | { | ||||
27 | my $attr = (shift)->associated_attribute; | ||||
28 | my $meta_instance = $attr->associated_class->instance_metaclass; | ||||
29 | |||||
30 | my $code = | ||||
31 | eval 'sub {' | ||||
32 | . $attr->associated_class()->inline_deinitialize_class_slot( $attr->name() ) | ||||
33 | . '}'; | ||||
34 | |||||
35 | confess "Could not generate inline clearer because : $@" if $@; | ||||
36 | |||||
37 | return $code; | ||||
38 | } | ||||
39 | |||||
40 | sub _inline_store | ||||
41 | # spent 66µs (34+32) within MooseX::ClassAttribute::Meta::Method::Accessor::_inline_store which was called
# once (34µs+32µs) by Moose::Meta::Method::Accessor::_generate_accessor_method_inline at line 52 of Moose/Meta/Method/Accessor.pm | ||||
42 | 8 | 25µs | my $self = shift; | ||
43 | shift; | ||||
44 | my $value = shift; | ||||
45 | |||||
46 | my $attr = $self->associated_attribute(); # spent 900ns making 1 call to Class::MOP::Method::Accessor::associated_attribute | ||||
47 | |||||
48 | my $meta = $attr->associated_class(); # spent 1µs making 1 call to Class::MOP::Attribute::associated_class | ||||
49 | |||||
50 | my $code = $meta->inline_set_class_slot_value( $attr->slots(), $value ) . ";"; # spent 23µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::inline_set_class_slot_value
# spent 4µs making 1 call to Class::MOP::Attribute::slots | ||||
51 | $code .= $meta->inline_weaken_class_slot_value( $attr->slots(), $value ) . ";" # spent 3µs making 1 call to Moose::Meta::Mixin::AttributeCore::is_weak_ref | ||||
52 | if $attr->is_weak_ref(); | ||||
53 | |||||
54 | return $code; | ||||
55 | } | ||||
56 | |||||
57 | sub _inline_get | ||||
58 | # spent 36µs (16+20) within MooseX::ClassAttribute::Meta::Method::Accessor::_inline_get which was called
# once (16µs+20µs) by Moose::Meta::Method::Accessor::_generate_accessor_method_inline at line 52 of Moose/Meta/Method/Accessor.pm | ||||
59 | 4 | 10µs | my $self = shift; | ||
60 | |||||
61 | my $attr = $self->associated_attribute; # spent 1µs making 1 call to Class::MOP::Method::Accessor::associated_attribute | ||||
62 | my $meta = $attr->associated_class(); # spent 1µs making 1 call to Class::MOP::Attribute::associated_class | ||||
63 | |||||
64 | return $meta->inline_get_class_slot_value( $attr->slots() ); # spent 14µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::inline_get_class_slot_value
# spent 4µs making 1 call to Class::MOP::Attribute::slots | ||||
65 | } | ||||
66 | |||||
67 | sub _inline_access | ||||
68 | { | ||||
69 | my $self = shift; | ||||
70 | |||||
71 | my $attr = $self->associated_attribute; | ||||
72 | my $meta = $attr->associated_class(); | ||||
73 | |||||
74 | return $meta->inline_class_slot_access( $attr->slots() ); | ||||
75 | } | ||||
76 | |||||
77 | sub _inline_has | ||||
78 | { | ||||
79 | my $self = shift; | ||||
80 | |||||
81 | my $attr = $self->associated_attribute; | ||||
82 | my $meta = $attr->associated_class(); | ||||
83 | |||||
84 | return $meta->inline_is_class_slot_initialized( $attr->slots() ); | ||||
85 | } | ||||
86 | |||||
87 | sub _inline_init_slot | ||||
88 | { | ||||
89 | my $self = shift; | ||||
90 | |||||
91 | return $self->_inline_store( undef, $_[-1] ); | ||||
92 | } | ||||
93 | |||||
94 | sub _inline_check_lazy | ||||
95 | # spent 61µs (45+16) within MooseX::ClassAttribute::Meta::Method::Accessor::_inline_check_lazy which was called
# once (45µs+16µs) by Moose::Meta::Method::Accessor::_generate_accessor_method_inline at line 52 of Moose/Meta/Method/Accessor.pm | ||||
96 | 2 | 40µs | my $self = shift; | ||
97 | |||||
98 | return | ||||
99 | $self->SUPER::_inline_check_lazy # spent 14µs making 1 call to Moose::Meta::Method::Accessor::_inline_check_lazy
# spent 900ns making 1 call to Class::MOP::Attribute::associated_class
# spent 800ns making 1 call to Class::MOP::Method::Accessor::associated_attribute
# spent 600ns making 1 call to Class::MOP::Package::name | ||||
100 | ( q{'} . $self->associated_attribute()->associated_class()->name() . q{'} ); | ||||
101 | } | ||||
102 | |||||
103 | sub _inline_get_old_value_for_trigger | ||||
104 | # spent 23µs (20+4) within MooseX::ClassAttribute::Meta::Method::Accessor::_inline_get_old_value_for_trigger which was called
# once (20µs+4µs) by Moose::Meta::Method::Accessor::_generate_accessor_method_inline at line 52 of Moose/Meta/Method/Accessor.pm | ||||
105 | 3 | 16µs | my $self = shift; | ||
106 | |||||
107 | my $attr = $self->associated_attribute(); # spent 1µs making 1 call to Class::MOP::Method::Accessor::associated_attribute | ||||
108 | return '' unless $attr->has_trigger(); # spent 3µs making 1 call to Moose::Meta::Mixin::AttributeCore::has_trigger | ||||
109 | |||||
110 | my $pred = | ||||
111 | $attr->associated_class()->inline_is_class_slot_initialized( $attr->name() ); | ||||
112 | |||||
113 | return | ||||
114 | 'my @old = ' | ||||
115 | . $pred . q{ ? } | ||||
116 | . $self->_inline_get() . q{ : ()} . ";\n"; | ||||
117 | |||||
118 | } | ||||
119 | |||||
120 | 3 | 55µs | 2 | 242µs | # spent 126µs (9+116) within MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@120 which was called
# once (9µs+116µs) by MooseX::ClassAttribute::Role::Meta::Attribute::BEGIN@6 at line 120 # spent 126µs making 1 call to MooseX::ClassAttribute::Meta::Method::Accessor::BEGIN@120
# spent 116µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:478] |
121 | |||||
122 | 1 | 9µs | 1; | ||
123 | |||||
124 | =pod | ||||
125 | |||||
126 | =head1 NAME | ||||
127 | |||||
128 | MooseX::ClassAttribute::Meta::Method::Accessor - Accessor method generation for class attributes | ||||
129 | |||||
130 | =head1 DESCRIPTION | ||||
131 | |||||
132 | This class overrides L<Moose::Meta::Method::Accessor> to do code | ||||
133 | generation properly for class attributes. | ||||
134 | |||||
135 | =head1 AUTHOR | ||||
136 | |||||
137 | Dave Rolsky, C<< <autarch@urth.org> >> | ||||
138 | |||||
139 | =head1 BUGS | ||||
140 | |||||
141 | See L<MooseX::ClassAttribute> for details. | ||||
142 | |||||
143 | =head1 COPYRIGHT & LICENSE | ||||
144 | |||||
145 | Copyright 2007-2008 Dave Rolsky, All Rights Reserved. | ||||
146 | |||||
147 | This program is free software; you can redistribute it and/or modify | ||||
148 | it under the same terms as Perl itself. | ||||
149 | |||||
150 | =cut |