line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MOP::Mixin::AttributeCore; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2205'; |
3
|
|
|
|
|
|
|
|
4
|
450
|
|
|
450
|
|
3287
|
use strict; |
|
450
|
|
|
|
|
995
|
|
|
450
|
|
|
|
|
13596
|
|
5
|
450
|
|
|
450
|
|
2357
|
use warnings; |
|
450
|
|
|
|
|
1026
|
|
|
450
|
|
|
|
|
12187
|
|
6
|
|
|
|
|
|
|
|
7
|
450
|
|
|
450
|
|
2658
|
use Scalar::Util 'blessed'; |
|
450
|
|
|
|
|
1031
|
|
|
450
|
|
|
|
|
22733
|
|
8
|
|
|
|
|
|
|
|
9
|
450
|
|
|
450
|
|
3028
|
use parent 'Class::MOP::Mixin'; |
|
450
|
|
|
|
|
1260
|
|
|
450
|
|
|
|
|
3133
|
|
10
|
|
|
|
|
|
|
|
11
|
86247
|
|
|
86247
|
|
316764
|
sub has_accessor { defined $_[0]->{'accessor'} } |
12
|
86313
|
|
|
86313
|
|
355774
|
sub has_reader { defined $_[0]->{'reader'} } |
13
|
86206
|
|
|
86206
|
|
276046
|
sub has_writer { defined $_[0]->{'writer'} } |
14
|
86204
|
|
|
86204
|
|
272436
|
sub has_predicate { defined $_[0]->{'predicate'} } |
15
|
86202
|
|
|
86202
|
|
232460
|
sub has_clearer { defined $_[0]->{'clearer'} } |
16
|
74963
|
|
|
74963
|
|
185878
|
sub has_builder { defined $_[0]->{'builder'} } |
17
|
347
|
|
|
347
|
|
4899
|
sub has_init_arg { defined $_[0]->{'init_arg'} } |
18
|
119660
|
|
|
119660
|
|
363638
|
sub has_default { exists $_[0]->{'default'} } |
19
|
284180
|
|
|
284180
|
|
909981
|
sub has_initializer { defined $_[0]->{'initializer'} } |
20
|
0
|
|
|
0
|
|
0
|
sub has_insertion_order { defined $_[0]->{'insertion_order'} } |
21
|
|
|
|
|
|
|
|
22
|
57509
|
|
|
57509
|
|
119760
|
sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } |
23
|
|
|
|
|
|
|
|
24
|
100
|
100
|
|
100
|
0
|
264
|
sub has_read_method { $_[0]->has_reader || $_[0]->has_accessor } |
25
|
0
|
0
|
|
0
|
0
|
0
|
sub has_write_method { $_[0]->has_writer || $_[0]->has_accessor } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub is_default_a_coderef { |
28
|
|
|
|
|
|
|
# Uber hack because it is called from CMOP::Attribute constructor as |
29
|
|
|
|
|
|
|
# $class->is_default_a_coderef(\%options) |
30
|
90938
|
100
|
|
90938
|
0
|
222602
|
my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; |
31
|
|
|
|
|
|
|
|
32
|
90938
|
100
|
|
|
|
213373
|
return unless ref($value); |
33
|
|
|
|
|
|
|
|
34
|
66437
|
|
66
|
|
|
236945
|
return ref($value) eq 'CODE' |
35
|
|
|
|
|
|
|
|| ( blessed($value) && $value->isa('Class::MOP::Method') ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub default { |
39
|
175379
|
|
|
175379
|
0
|
281672
|
my ( $self, $instance ) = @_; |
40
|
175379
|
100
|
100
|
|
|
356717
|
if ( defined $instance && $self->is_default_a_coderef ) { |
41
|
|
|
|
|
|
|
# if the default is a CODE ref, then we pass in the instance and |
42
|
|
|
|
|
|
|
# default can return a value based on that instance. Somewhat crude, |
43
|
|
|
|
|
|
|
# but works. |
44
|
27833
|
|
|
|
|
99094
|
return $self->{'default'}->($instance); |
45
|
|
|
|
|
|
|
} |
46
|
147546
|
|
|
|
|
355118
|
$self->{'default'}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# ABSTRACT: Core attributes shared by attribute metaclasses |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=encoding UTF-8 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Class::MOP::Mixin::AttributeCore - Core attributes shared by attribute metaclasses |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 2.2205 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 DESCRIPTION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This class implements the core attributes (aka properties) shared by all |
70
|
|
|
|
|
|
|
attributes. See the L<Class::MOP::Attribute> documentation for API details. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHORS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Shawn M Moore <sartak@cpan.org> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Hans Dieter Pearcey <hdp@cpan.org> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Chris Prather <chris@prather.org> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Matt S Trout <mstrout@cpan.org> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=back |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Infinity Interactive, Inc. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
123
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |