line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Moose::Role; |
3
|
170
|
|
|
170
|
|
82824
|
use Moose::Meta::Class (); |
|
170
|
|
|
|
|
5938
|
|
|
170
|
|
|
|
|
1416
|
|
4
|
170
|
|
|
170
|
|
776900
|
use Class::MOP; |
|
170
|
|
|
|
|
408
|
|
|
170
|
|
|
|
|
3384
|
|
5
|
170
|
|
|
170
|
|
863
|
use Moose::Util (); |
|
170
|
|
|
|
|
382
|
|
|
170
|
|
|
|
|
3291
|
|
6
|
170
|
|
|
170
|
|
883
|
|
|
170
|
|
|
|
|
368
|
|
|
170
|
|
|
|
|
23815
|
|
7
|
|
|
|
|
|
|
my ($class, $attribute, $warn_on_instance) = @_; |
8
|
|
|
|
|
|
|
confess("mk_classdata() is a class method, not an object method") |
9
|
5157
|
|
|
5157
|
1
|
621595
|
if blessed $class; |
10
|
5157
|
50
|
|
|
|
11245
|
|
11
|
|
|
|
|
|
|
my $slot = '$'.$attribute; |
12
|
|
|
|
|
|
|
my $accessor = sub { |
13
|
5157
|
|
|
|
|
8793
|
my $pkg = ref $_[0] || $_[0]; |
14
|
|
|
|
|
|
|
my $meta = Moose::Util::find_meta($pkg) |
15
|
340938
|
|
66
|
340938
|
|
999510
|
|| Moose::Meta::Class->initialize( $pkg ); |
|
|
|
|
340882
|
|
|
|
|
|
|
|
340882
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340885
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340882
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340885
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
340866
|
|
|
|
|
|
|
|
302947
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
53
|
|
|
|
16
|
340938
|
|
66
|
|
|
715269
|
if (@_ > 1) { |
17
|
|
|
|
|
|
|
$meta->namespace->{$attribute} = \$_[1]; |
18
|
340938
|
100
|
|
|
|
4291253
|
return $_[1]; |
19
|
11430
|
|
|
|
|
34690
|
} |
20
|
11430
|
|
|
|
|
77183
|
|
21
|
|
|
|
|
|
|
# tighter version of |
22
|
|
|
|
|
|
|
# if ( $meta->has_package_symbol($slot) ) { |
23
|
|
|
|
|
|
|
# return ${ $meta->get_package_symbol($slot) }; |
24
|
|
|
|
|
|
|
# } |
25
|
|
|
|
|
|
|
no strict 'refs'; |
26
|
|
|
|
|
|
|
my $v = *{"${pkg}::${attribute}"}{SCALAR}; |
27
|
170
|
|
|
170
|
|
1179
|
if (defined ${$v}) { |
|
170
|
|
|
|
|
432
|
|
|
170
|
|
|
|
|
48053
|
|
28
|
329508
|
|
|
|
|
396108
|
return ${$v}; |
|
329508
|
|
|
|
|
984880
|
|
29
|
329508
|
100
|
|
|
|
414652
|
} else { |
|
329508
|
|
|
|
|
570383
|
|
30
|
238349
|
|
|
|
|
277199
|
foreach my $super ( $meta->linearized_isa ) { |
|
238349
|
|
|
|
|
902689
|
|
31
|
|
|
|
|
|
|
# tighter version of same after |
32
|
91159
|
|
|
|
|
256209
|
# my $super_meta = Moose::Meta::Class->initialize($super); |
33
|
|
|
|
|
|
|
my $v = ${"${super}::"}{$attribute} ? *{"${super}::${attribute}"}{SCALAR} : undef; |
34
|
|
|
|
|
|
|
if (defined ${$v}) { |
35
|
267516
|
100
|
|
|
|
902447
|
return ${$v}; |
|
267516
|
|
|
|
|
681685
|
|
|
210426
|
|
|
|
|
436872
|
|
36
|
267516
|
100
|
|
|
|
298528
|
} |
|
267516
|
|
|
|
|
475248
|
|
37
|
83802
|
|
|
|
|
103201
|
} |
|
83802
|
|
|
|
|
280782
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
return; |
40
|
|
|
|
|
|
|
}; |
41
|
7357
|
|
|
|
|
35313
|
|
42
|
5157
|
|
|
|
|
24435
|
confess("Failed to create accessor: $@ ") |
43
|
|
|
|
|
|
|
unless ref $accessor eq 'CODE'; |
44
|
5157
|
50
|
|
|
|
12710
|
|
45
|
|
|
|
|
|
|
my $meta = $class->Class::MOP::Object::meta(); |
46
|
|
|
|
|
|
|
confess "${class}'s metaclass is not a Class::MOP::Class" |
47
|
5157
|
|
|
|
|
13603
|
unless $meta->isa('Class::MOP::Class'); |
48
|
5157
|
50
|
|
|
|
81611
|
|
49
|
|
|
|
|
|
|
my $was_immutable = $meta->is_immutable; |
50
|
|
|
|
|
|
|
my %immutable_options = $meta->immutable_options; |
51
|
5157
|
|
|
|
|
11014
|
|
52
|
5157
|
|
|
|
|
18094
|
$meta->make_mutable if $was_immutable; |
53
|
|
|
|
|
|
|
|
54
|
5157
|
50
|
|
|
|
30771
|
my $alias = "_${attribute}_accessor"; |
55
|
|
|
|
|
|
|
$meta->add_method($alias, $accessor); |
56
|
5157
|
|
|
|
|
9092
|
$meta->add_method($attribute, $accessor); |
57
|
5157
|
|
|
|
|
12125
|
|
58
|
5157
|
|
|
|
|
198574
|
$meta->make_immutable(%immutable_options) if $was_immutable; |
59
|
|
|
|
|
|
|
|
60
|
5157
|
50
|
|
|
|
147935
|
$class->$attribute($_[2]) if(@_ > 2); |
61
|
|
|
|
|
|
|
return $accessor; |
62
|
5157
|
100
|
|
|
|
9779
|
} |
63
|
5157
|
|
|
|
|
15088
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Catalyst::ClassData - Class data accessors |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 mk_classdata $name, $optional_value |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
A moose-safe clone of L<Class::Data::Inheritable> that borrows some ideas from |
77
|
|
|
|
|
|
|
L<Class::Accessor::Grouped>; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=begin stopwords |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Guillermo Roditi |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=end stopwords |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This library is free software. You can redistribute it and/or modify it under |
90
|
|
|
|
|
|
|
the same terms as Perl itself. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |