Profile of /usr/local/lib/perl5/site_perl/5.10.1/MooseX/ClassAttribute/Role/Meta/Class.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 05.Domain_and_Item.t
Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:20 2010

File | /usr/local/lib/perl5/site_perl/5.10.1/MooseX/ClassAttribute/Role/Meta/Class.pm
Statements Executed | 76
Statement Execution Time | 1.45ms

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 776µs | 193ms | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@6MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6
1 | 1 | 1 | 686µs | 6.40ms | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@7MooseX::ClassAttribute::Role::Meta::Class::BEGIN@7
1 | 1 | 1 | 66µs | 11.2ms | MooseX::ClassAttribute::Role::Meta::Class::::add_class_attributeMooseX::ClassAttribute::Role::Meta::Class::add_class_attribute
1 | 1 | 1 | 33µs | 8.69ms | MooseX::ClassAttribute::Role::Meta::Class::::_process_class_attributeMooseX::ClassAttribute::Role::Meta::Class::_process_class_attribute
1 | 1 | 1 | 28µs | 42µs | MooseX::ClassAttribute::Role::Meta::Class::::_class_attribute_values_hashrefMooseX::ClassAttribute::Role::Meta::Class::_class_attribute_values_hashref
1 | 1 | 1 | 18µs | 8.65ms | MooseX::ClassAttribute::Role::Meta::Class::::_process_new_class_attributeMooseX::ClassAttribute::Role::Meta::Class::_process_new_class_attribute
3 | 2 | 1 | 18µs | 21µs | MooseX::ClassAttribute::Role::Meta::Class::::_class_attribute_var_nameMooseX::ClassAttribute::Role::Meta::Class::_class_attribute_var_name
1 | 1 | 1 | 15µs | 18µs | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@3MooseX::ClassAttribute::Role::Meta::Class::BEGIN@3
2 | 2 | 1 | 14µs | 21µs | MooseX::ClassAttribute::Role::Meta::Class::::inline_class_slot_accessMooseX::ClassAttribute::Role::Meta::Class::inline_class_slot_access
1 | 1 | 1 | 12µs | 31µs | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@186MooseX::ClassAttribute::Role::Meta::Class::BEGIN@186
1 | 1 | 1 | 11µs | 53µs | MooseX::ClassAttribute::Role::Meta::Class::::__ANON__[:37]MooseX::ClassAttribute::Role::Meta::Class::__ANON__[:37]
1 | 1 | 1 | 9µs | 23µs | MooseX::ClassAttribute::Role::Meta::Class::::inline_set_class_slot_valueMooseX::ClassAttribute::Role::Meta::Class::inline_set_class_slot_value
1 | 1 | 1 | 9µs | 51µs | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@8MooseX::ClassAttribute::Role::Meta::Class::BEGIN@8
1 | 1 | 1 | 8µs | 17µs | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@4MooseX::ClassAttribute::Role::Meta::Class::BEGIN@4
1 | 1 | 1 | 8µs | 106µs | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@246MooseX::ClassAttribute::Role::Meta::Class::BEGIN@246
1 | 1 | 1 | 7µs | 1.36ms | MooseX::ClassAttribute::Role::Meta::Class::::BEGIN@10MooseX::ClassAttribute::Role::Meta::Class::BEGIN@10
1 | 1 | 1 | 6µs | 14µs | MooseX::ClassAttribute::Role::Meta::Class::::inline_get_class_slot_valueMooseX::ClassAttribute::Role::Meta::Class::inline_get_class_slot_value
2 | 1 | 1 | 6µs | 6µs | MooseX::ClassAttribute::Role::Meta::Class::::__ANON__[:23]MooseX::ClassAttribute::Role::Meta::Class::__ANON__[:23]
1 | 1 | 2 | 700ns | 700ns | MooseX::ClassAttribute::Role::Meta::Class::::CORE:matchMooseX::ClassAttribute::Role::Meta::Class::CORE:match (opcode)
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::_process_inherited_class_attributeMooseX::ClassAttribute::Role::Meta::Class::_process_inherited_class_attribute
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::compute_all_applicable_class_attributesMooseX::ClassAttribute::Role::Meta::Class::compute_all_applicable_class_attributes
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::find_class_attribute_by_nameMooseX::ClassAttribute::Role::Meta::Class::find_class_attribute_by_name
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::get_all_class_attributesMooseX::ClassAttribute::Role::Meta::Class::get_all_class_attributes
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::inline_deinitialize_class_slotMooseX::ClassAttribute::Role::Meta::Class::inline_deinitialize_class_slot
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::inline_is_class_slot_initializedMooseX::ClassAttribute::Role::Meta::Class::inline_is_class_slot_initialized
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::inline_weaken_class_slot_valueMooseX::ClassAttribute::Role::Meta::Class::inline_weaken_class_slot_value
0 | 0 | 0 | 0s | 0s | MooseX::ClassAttribute::Role::Meta::Class::::remove_class_attributeMooseX::ClassAttribute::Role::Meta::Class::remove_class_attribute

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package MooseX::ClassAttribute::Role::Meta::Class;
2 |  |  |  |  |
3 | 3 | 29µs | 2 | 21µs | # spent 18µs (15+3) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@3 which was called # once (15µs+3µs) by MooseX::ClassAttribute::BEGIN@11 at line 3 use strict; # spent 18µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@3 # spent 3µs making 1 call to strict::import
4 | 3 | 21µs | 2 | 26µs | # spent 17µs (8+9) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@4 which was called # once (8µs+9µs) by MooseX::ClassAttribute::BEGIN@11 at line 4 use warnings; # spent 17µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@4 # spent 9µs making 1 call to warnings::import
5 |  |  |  |  |
6 | 3 | 167µs | 1 | 193ms | # spent 193ms (776µs+192) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 which was called # once (776µs+192ms) by MooseX::ClassAttribute::BEGIN@11 at line 6 use MooseX::AttributeHelpers; # spent 193ms making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6
7 | 3 | 136µs | 1 | 6.40ms | # spent 6.40ms (686µs+5.71) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@7 which was called # once (686µs+5.71ms) by MooseX::ClassAttribute::BEGIN@11 at line 7 use MooseX::ClassAttribute::Role::Meta::Attribute; # spent 6.40ms making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@7
8 | 3 | 24µs | 2 | 93µs | # spent 51µs (9+42) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@8 which was called # once (9µs+42µs) by MooseX::ClassAttribute::BEGIN@11 at line 8 use Scalar::Util qw( blessed ); # spent 51µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@8 # spent 42µs making 1 call to Exporter::import
9 |  |  |  |  |
10 | 3 | 583µs | 2 | 2.71ms | # spent 1.36ms (7µs+1.35) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@10 which was called # once (7µs+1.35ms) by MooseX::ClassAttribute::BEGIN@11 at line 10 use Moose::Role; # spent 1.36ms making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@10 # spent 1.35ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389]
11 |  |  |  |  |
12 |  |  |  |  |
13 |  |  |  |  | has class_attribute_map =>
14 |  |  |  |  | ( metaclass => 'Collection::Hash',
15 |  |  |  |  | is => 'ro',
16 |  |  |  |  | isa => 'HashRef[Moose::Meta::Attribute]',
17 |  |  |  |  | provides => { set => '_add_class_attribute',
18 |  |  |  |  | exists => 'has_class_attribute',
19 |  |  |  |  | get => 'get_class_attribute',
20 |  |  |  |  | delete => '_remove_class_attribute',
21 |  |  |  |  | keys => 'get_class_attribute_list',
22 |  |  |  |  | },
23 | 2 | 8µs |  |  | # spent 6µs within MooseX::ClassAttribute::Role::Meta::Class::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/ClassAttribute/Role/Meta/Class.pm:23] which was called 2 times, avg 3µs/call: # 2 times (6µs+0s) by Class::MOP::Mixin::AttributeCore::default at line 53 of Class/MOP/Mixin/AttributeCore.pm, avg 3µs/call default => sub { {} },
24 | 1 | 8µs | 1 | 194µs | reader => 'get_class_attribute_map', # spent 194µs making 1 call to Moose::Role::has
25 |  |  |  |  | );
26 |  |  |  |  |
27 |  |  |  |  | has _class_attribute_values =>
28 |  |  |  |  | ( metaclass => 'Collection::Hash',
29 |  |  |  |  | is => 'ro',
30 |  |  |  |  | isa => 'HashRef',
31 |  |  |  |  | provides => { get => 'get_class_attribute_value',
32 |  |  |  |  | set => 'set_class_attribute_value',
33 |  |  |  |  | exists => 'has_class_attribute_value',
34 |  |  |  |  | delete => 'clear_class_attribute_value',
35 |  |  |  |  | },
36 |  |  |  |  | lazy => 1,
37 | 1 | 8µs | 1 | 42µs | # spent 53µs (11+42) within MooseX::ClassAttribute::Role::Meta::Class::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/ClassAttribute/Role/Meta/Class.pm:37] which was called # once (11µs+42µs) by Class::MOP::Mixin::AttributeCore::default at line 53 of Class/MOP/Mixin/AttributeCore.pm default => sub { $_[0]->_class_attribute_values_hashref() }, # spent 42µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::_class_attribute_values_hashref
38 | 1 | 7µs | 1 | 103µs | ); # spent 103µs making 1 call to Moose::Role::has
39 |  |  |  |  |
40 |  |  |  |  |
41 |  |  |  |  | sub add_class_attribute
42 |  |  |  |  | # spent 11.2ms (66µs+11.2) within MooseX::ClassAttribute::Role::Meta::Class::add_class_attribute which was called # once (66µs+11.2ms) by MooseX::ClassAttribute::class_has at line 41 of MooseX/ClassAttribute.pm {
43 | 13 | 56µs |  |  | my $self = shift;
44 |  |  |  |  |
45 |  |  |  |  | my $attr = # spent 8.69ms making 1 call to MooseX::ClassAttribute::Role::Meta::Class::_process_class_attribute # spent 800ns making 1 call to Scalar::Util::blessed
46 |  |  |  |  | blessed $_[0] && $_[0]->isa('Class::MOP::Attribute')
47 |  |  |  |  | ? $_[0]
48 |  |  |  |  | : $self->_process_class_attribute(@_);
49 |  |  |  |  |
50 |  |  |  |  | my $name = $attr->name(); # spent 2µs making 1 call to Class::MOP::Mixin::AttributeCore::name
51 |  |  |  |  |
52 |  |  |  |  | $self->remove_class_attribute($name) # spent 43µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::1::has_class_attribute
53 |  |  |  |  | if $self->has_class_attribute($name);
54 |  |  |  |  |
55 |  |  |  |  | $attr->attach_to_class($self); # spent 403µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::2::attach_to_class
56 |  |  |  |  |
57 |  |  |  |  | $self->_add_class_attribute( $name => $attr ); # spent 102µs making 1 call to Class::MOP::Class::__ANON__::SERIAL::1::_add_class_attribute
58 |  |  |  |  |
59 |  |  |  |  | my $e = do { local $@; eval { $attr->install_accessors() }; $@ }; # spent 1.94ms making 1 call to Moose::Meta::Attribute::install_accessors
60 |  |  |  |  |
61 |  |  |  |  | if ( $e )
62 |  |  |  |  | {
63 |  |  |  |  | $self->remove_attribute($name);
64 |  |  |  |  | die $e;
65 |  |  |  |  | }
66 |  |  |  |  |
67 |  |  |  |  | return $attr;
68 |  |  |  |  | }
69 |  |  |  |  |
70 |  |  |  |  | # It'd be nice if I didn't have to replicate this for class
71 |  |  |  |  | # attributes, since it's basically just a copy of
72 |  |  |  |  | # Moose::Meta::Class->_process_attribute
73 |  |  |  |  | sub _process_class_attribute
74 |  |  |  |  | # spent 8.69ms (33µs+8.65) within MooseX::ClassAttribute::Role::Meta::Class::_process_class_attribute which was called # once (33µs+8.65ms) by MooseX::ClassAttribute::Role::Meta::Class::add_class_attribute at line 45 {
75 | 6 | 22µs |  |  | my $self = shift;
76 |  |  |  |  | my $name = shift;
77 |  |  |  |  | my @args = @_;
78 |  |  |  |  |
79 |  |  |  |  | @args = %{$args[0]} if scalar @args == 1 && ref($args[0]) eq 'HASH';
80 |  |  |  |  |
81 |  |  |  |  | if ($name =~ /^\+(.*)/) # spent 700ns making 1 call to MooseX::ClassAttribute::Role::Meta::Class::CORE:match
82 |  |  |  |  | {
83 |  |  |  |  | return $self->_process_inherited_class_attribute( $1, @args );
84 |  |  |  |  | }
85 |  |  |  |  | else
86 |  |  |  |  | {
87 |  |  |  |  | return $self->_process_new_class_attribute( $name, @args ); # spent 8.65ms making 1 call to MooseX::ClassAttribute::Role::Meta::Class::_process_new_class_attribute
88 |  |  |  |  | }
89 |  |  |  |  | }
90 |  |  |  |  |
91 |  |  |  |  | sub _process_new_class_attribute
92 |  |  |  |  | # spent 8.65ms (18µs+8.63) within MooseX::ClassAttribute::Role::Meta::Class::_process_new_class_attribute which was called # once (18µs+8.63ms) by MooseX::ClassAttribute::Role::Meta::Class::_process_class_attribute at line 87 {
93 | 6 | 26µs |  |  | my $self = shift;
94 |  |  |  |  | my $name = shift;
95 |  |  |  |  | my %p = @_;
96 |  |  |  |  |
97 |  |  |  |  | if ( $p{traits} )
98 |  |  |  |  | {
99 |  |  |  |  | push @{ $p{traits} },'MooseX::ClassAttribute::Role::Meta::Attribute'
100 |  |  |  |  | }
101 |  |  |  |  | else
102 |  |  |  |  | {
103 |  |  |  |  | $p{traits} = [ 'MooseX::ClassAttribute::Role::Meta::Attribute' ];
104 |  |  |  |  | }
105 |  |  |  |  |
106 |  |  |  |  | return Moose::Meta::Attribute->interpolate_class_and_new( $name, %p ); # spent 8.63ms making 1 call to Moose::Meta::Attribute::interpolate_class_and_new
107 |  |  |  |  | }
108 |  |  |  |  |
109 |  |  |  |  | sub _process_inherited_class_attribute
110 |  |  |  |  | {
111 |  |  |  |  | my $self = shift;
112 |  |  |  |  | my $name = shift;
113 |  |  |  |  | my %p = @_;
114 |  |  |  |  |
115 |  |  |  |  | my $inherited_attr = $self->find_class_attribute_by_name($name);
116 |  |  |  |  |
117 |  |  |  |  | (defined $inherited_attr)
118 |  |  |  |  | || confess "Could not find an attribute by the name of '$name' to inherit from";
119 |  |  |  |  |
120 |  |  |  |  | return $inherited_attr->clone_and_inherit_options(%p);
121 |  |  |  |  | }
122 |  |  |  |  |
123 |  |  |  |  | sub remove_class_attribute
124 |  |  |  |  | {
125 |  |  |  |  | my $self = shift;
126 |  |  |  |  | my $name = shift;
127 |  |  |  |  |
128 |  |  |  |  | (defined $name && $name)
129 |  |  |  |  | || confess 'You must provide an attribute name';
130 |  |  |  |  |
131 |  |  |  |  | my $removed_attr = $self->get_class_attribute($name);
132 |  |  |  |  | return unless $removed_attr;
133 |  |  |  |  |
134 |  |  |  |  | $self->_remove_class_attribute($name);
135 |  |  |  |  |
136 |  |  |  |  | $removed_attr->remove_accessors();
137 |  |  |  |  | $removed_attr->detach_from_class();
138 |  |  |  |  |
139 |  |  |  |  | return $removed_attr;
140 |  |  |  |  | }
141 |  |  |  |  |
142 |  |  |  |  | sub get_all_class_attributes
143 |  |  |  |  | {
144 |  |  |  |  | my $self = shift;
145 |  |  |  |  |
146 |  |  |  |  | my %attrs =
147 |  |  |  |  | map { my $meta = Class::MOP::class_of($_);
148 |  |  |  |  | $meta && $meta->can('get_class_attribute_map')
149 |  |  |  |  | ? %{ $meta->get_class_attribute_map() }
150 |  |  |  |  | : ()
151 |  |  |  |  | }
152 |  |  |  |  | reverse $self->linearized_isa;
153 |  |  |  |  |
154 |  |  |  |  | return values %attrs;
155 |  |  |  |  | }
156 |  |  |  |  |
157 |  |  |  |  | sub compute_all_applicable_class_attributes
158 |  |  |  |  | {
159 |  |  |  |  | warn 'The compute_all_applicable_class_attributes method has been deprecated.'
160 |  |  |  |  | . " Use get_all_class_attributes instead.\n";
161 |  |  |  |  |
162 |  |  |  |  | shift->compute_all_applicable_class_attributes(@_);
163 |  |  |  |  | }
164 |  |  |  |  |
165 |  |  |  |  | sub find_class_attribute_by_name
166 |  |  |  |  | {
167 |  |  |  |  | my $self = shift;
168 |  |  |  |  | my $name = shift;
169 |  |  |  |  |
170 |  |  |  |  | foreach my $class ( $self->linearized_isa() )
171 |  |  |  |  | {
172 |  |  |  |  | my $meta = Class::MOP::class_of($class)
173 |  |  |  |  | or next;
174 |  |  |  |  |
175 |  |  |  |  | return $meta->get_class_attribute($name)
176 |  |  |  |  | if $meta->can('has_class_attribute') && $meta->has_class_attribute($name);
177 |  |  |  |  | }
178 |  |  |  |  |
179 |  |  |  |  | return;
180 |  |  |  |  | }
181 |  |  |  |  |
182 |  |  |  |  | sub _class_attribute_values_hashref
183 |  |  |  |  | # spent 42µs (28+13) within MooseX::ClassAttribute::Role::Meta::Class::_class_attribute_values_hashref which was called # once (28µs+13µs) by MooseX::ClassAttribute::Role::Meta::Class::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/MooseX/ClassAttribute/Role/Meta/Class.pm:37] at line 37 {
184 | 2 | 16µs |  |  | my $self = shift;
185 |  |  |  |  |
186 | 3 | 214µs | 2 | 50µs | # spent 31µs (12+19) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@186 which was called # once (12µs+19µs) by MooseX::ClassAttribute::BEGIN@11 at line 186 no strict 'refs'; # spent 31µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@186 # spent 19µs making 1 call to strict::unimport
187 |  |  |  |  | return \%{ $self->_class_attribute_var_name() }; # spent 13µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::_class_attribute_var_name
188 |  |  |  |  | }
189 |  |  |  |  |
190 |  |  |  |  | sub _class_attribute_var_name
191 |  |  |  |  | # spent 21µs (18+3) within MooseX::ClassAttribute::Role::Meta::Class::_class_attribute_var_name which was called 3 times, avg 7µs/call: # 2 times (7µs+1µs) by MooseX::ClassAttribute::Role::Meta::Class::inline_class_slot_access at line 202, avg 4µs/call # once (12µs+2µs) by MooseX::ClassAttribute::Role::Meta::Class::_class_attribute_values_hashref at line 187 {
192 | 6 | 40µs |  |  | my $self = shift;
193 |  |  |  |  |
194 |  |  |  |  | return $self->name() . q'::__ClassAttributeValues'; # spent 3µs making 3 calls to Class::MOP::Package::name, avg 1µs/call
195 |  |  |  |  | }
196 |  |  |  |  |
197 |  |  |  |  | sub inline_class_slot_access
198 |  |  |  |  | # spent 21µs (14+8) within MooseX::ClassAttribute::Role::Meta::Class::inline_class_slot_access which was called 2 times, avg 11µs/call: # once (10µs+4µs) by MooseX::ClassAttribute::Role::Meta::Class::inline_set_class_slot_value at line 219 # once (4µs+4µs) by MooseX::ClassAttribute::Role::Meta::Class::inline_get_class_slot_value at line 210 {
199 | 6 | 13µs |  |  | my $self = shift;
200 |  |  |  |  | my $name = shift;
201 |  |  |  |  |
202 |  |  |  |  | return '$' . $self->_class_attribute_var_name . '{"' . quotemeta($name) . '"}'; # spent 8µs making 2 calls to MooseX::ClassAttribute::Role::Meta::Class::_class_attribute_var_name, avg 4µs/call
203 |  |  |  |  | }
204 |  |  |  |  |
205 |  |  |  |  | sub inline_get_class_slot_value
206 |  |  |  |  | # spent 14µs (6+8) within MooseX::ClassAttribute::Role::Meta::Class::inline_get_class_slot_value which was called # once (6µs+8µs) by MooseX::ClassAttribute::Meta::Method::Accessor::_inline_get at line 64 of MooseX/ClassAttribute/Meta/Method/Accessor.pm {
207 | 3 | 5µs |  |  | my $self = shift;
208 |  |  |  |  | my $name = shift;
209 |  |  |  |  |
210 |  |  |  |  | return $self->inline_class_slot_access($name); # spent 7µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::inline_class_slot_access
211 |  |  |  |  | }
212 |  |  |  |  |
213 |  |  |  |  | sub inline_set_class_slot_value
214 |  |  |  |  | # spent 23µs (9+14) within MooseX::ClassAttribute::Role::Meta::Class::inline_set_class_slot_value which was called # once (9µs+14µs) by MooseX::ClassAttribute::Meta::Method::Accessor::_inline_store at line 50 of MooseX/ClassAttribute/Meta/Method/Accessor.pm {
215 | 4 | 8µs |  |  | my $self = shift;
216 |  |  |  |  | my $name = shift;
217 |  |  |  |  | my $val_name = shift;
218 |  |  |  |  |
219 |  |  |  |  | return $self->inline_class_slot_access($name) . ' = ' . $val_name; # spent 14µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::inline_class_slot_access
220 |  |  |  |  | }
221 |  |  |  |  |
222 |  |  |  |  | sub inline_is_class_slot_initialized
223 |  |  |  |  | {
224 |  |  |  |  | my $self = shift;
225 |  |  |  |  | my $name = shift;
226 |  |  |  |  |
227 |  |  |  |  | return 'exists ' . $self->inline_class_slot_access($name);
228 |  |  |  |  | }
229 |  |  |  |  |
230 |  |  |  |  | sub inline_deinitialize_class_slot
231 |  |  |  |  | {
232 |  |  |  |  | my $self = shift;
233 |  |  |  |  | my $name = shift;
234 |  |  |  |  |
235 |  |  |  |  | return 'delete ' . $self->inline_class_slot_access($name);
236 |  |  |  |  | }
237 |  |  |  |  |
238 |  |  |  |  | sub inline_weaken_class_slot_value
239 |  |  |  |  | {
240 |  |  |  |  | my $self = shift;
241 |  |  |  |  | my $name = shift;
242 |  |  |  |  |
243 |  |  |  |  | return 'Scalar::Util::weaken( ' . $self->inline_class_slot_access($name) . ')';
244 |  |  |  |  | }
245 |  |  |  |  |
246 | 3 | 35µs | 2 | 204µs | # spent 106µs (8+98) within MooseX::ClassAttribute::Role::Meta::Class::BEGIN@246 which was called # once (8µs+98µs) by MooseX::ClassAttribute::BEGIN@11 at line 246 no Moose::Role; # spent 106µs making 1 call to MooseX::ClassAttribute::Role::Meta::Class::BEGIN@246 # spent 98µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:478]
247 |  |  |  |  |
248 | 1 | 19µs |  |  | 1;
249 |  |  |  |  |
250 |  |  |  |  | __END__
251 |  |  |  |  |
252 |  |  |  |  | =pod
253 |  |  |  |  |
254 |  |  |  |  | =head1 NAME
255 |  |  |  |  |
256 |  |  |  |  | MooseX::ClassAttribute::Role::Meta::Class - A metaclass role for classes with class attributes
257 |  |  |  |  |
258 |  |  |  |  | =head1 SYNOPSIS
259 |  |  |  |  |
260 |  |  |  |  | for my $attr ( HasClassAttributes->meta()->get_all_class_attributes() )
261 |  |  |  |  | {
262 |  |  |  |  | print $attr->name();
263 |  |  |  |  | }
264 |  |  |  |  |
265 |  |  |  |  | =head1 DESCRIPTION
266 |  |  |  |  |
267 |  |  |  |  | This role adds awareness of class attributes to a metaclass object. It
268 |  |  |  |  | provides a set of introspection methods that largely parallel the
269 |  |  |  |  | existing attribute methods, except they operate on class attributes.
270 |  |  |  |  |
271 |  |  |  |  | =head1 METHODS
272 |  |  |  |  |
273 |  |  |  |  | Every method provided by this role has an analogous method in
274 |  |  |  |  | C<Class::MOP::Class> or C<Moose::Meta::Class> for regular attributes.
275 |  |  |  |  |
276 |  |  |  |  | =head2 $meta->has_class_attribute($name)
277 |  |  |  |  |
278 |  |  |  |  | =head2 $meta->get_class_attribute($name)
279 |  |  |  |  |
280 |  |  |  |  | =head2 $meta->get_class_attribute_list()
281 |  |  |  |  |
282 |  |  |  |  | =head2 $meta->get_class_attribute_map()
283 |  |  |  |  |
284 |  |  |  |  | These methods operate on the current metaclass only.
285 |  |  |  |  |
286 |  |  |  |  | =head2 $meta->add_class_attribute(...)
287 |  |  |  |  |
288 |  |  |  |  | This accepts the same options as the L<Moose::Meta::Attribute>
289 |  |  |  |  | C<add_attribute()> method. However, if an attribute is specified as
290 |  |  |  |  | "required" an error will be thrown.
291 |  |  |  |  |
292 |  |  |  |  | =head2 $meta->remove_class_attribute($name)
293 |  |  |  |  |
294 |  |  |  |  | If the named class attribute exists, it is removed from the class,
295 |  |  |  |  | along with its accessor methods.
296 |  |  |  |  |
297 |  |  |  |  | =head2 $meta->get_all_class_attributes()
298 |  |  |  |  |
299 |  |  |  |  | This method returns a list of attribute objects for the class and all
300 |  |  |  |  | its parent classes.
301 |  |  |  |  |
302 |  |  |  |  | =head2 $meta->find_class_attribute_by_name($name)
303 |  |  |  |  |
304 |  |  |  |  | This method looks at the class and all its parent classes for the
305 |  |  |  |  | named class attribute.
306 |  |  |  |  |
307 |  |  |  |  | =head2 $meta->get_class_attribute_value($name)
308 |  |  |  |  |
309 |  |  |  |  | =head2 $meta->set_class_attribute_value($name, $value)
310 |  |  |  |  |
311 |  |  |  |  | =head2 $meta->set_class_attribute_value($name)
312 |  |  |  |  |
313 |  |  |  |  | =head2 $meta->clear_class_attribute_value($name)
314 |  |  |  |  |
315 |  |  |  |  | These methods operate on the storage for class attribute values, which
316 |  |  |  |  | is attached to the metaclass object.
317 |  |  |  |  |
318 |  |  |  |  | There's really no good reason for you to call these methods unless
319 |  |  |  |  | you're doing some deep hacking. They are named as public methods
320 |  |  |  |  | solely because they are used by other meta roles and classes in this
321 |  |  |  |  | distribution.
322 |  |  |  |  |
323 |  |  |  |  | =head2 inline_class_slot_access($name)
324 |  |  |  |  |
325 |  |  |  |  | =head2 inline_get_class_slot_value($name)
326 |  |  |  |  |
327 |  |  |  |  | =head2 inline_set_class_slot_value($name, $val_name)
328 |  |  |  |  |
329 |  |  |  |  | =head2 inline_is_class_slot_initialized($name)
330 |  |  |  |  |
331 |  |  |  |  | =head2 inline_deinitialize_class_slot($name)
332 |  |  |  |  |
333 |  |  |  |  | =head2 inline_weaken_class_slot_value($name)
334 |  |  |  |  |
335 |  |  |  |  | These methods return code snippets for inlining.
336 |  |  |  |  |
337 |  |  |  |  | There's really no good reason for you to call these methods unless
338 |  |  |  |  | you're doing some deep hacking. They are named as public methods
339 |  |  |  |  | solely because they are used by other meta roles and classes in this
340 |  |  |  |  | distribution.
341 |  |  |  |  |
342 |  |  |  |  | =head1 AUTHOR
343 |  |  |  |  |
344 |  |  |  |  | Dave Rolsky, C<< <autarch@urth.org> >>
345 |  |  |  |  |
346 |  |  |  |  | =head1 BUGS
347 |  |  |  |  |
348 |  |  |  |  | See L<MooseX::ClassAttribute> for details.
349 |  |  |  |  |
350 |  |  |  |  | =head1 COPYRIGHT & LICENSE
351 |  |  |  |  |
352 |  |  |  |  | Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
353 |  |  |  |  |
354 |  |  |  |  | This program is free software; you can redistribute it and/or modify
355 |  |  |  |  | it under the same terms as Perl itself.
356 |  |  |  |  |
357 |  |  |  |  | =cut
|  |  |  |  | # spent 700ns within MooseX::ClassAttribute::Role::Meta::Class::CORE:match which was called # once (700ns+0s) by MooseX::ClassAttribute::Role::Meta::Class::_process_class_attribute at line 81 of MooseX/ClassAttribute/Role/Meta/Class.pm sub MooseX::ClassAttribute::Role::Meta::Class::CORE:match; # xsub