line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MOP::Mixin::AttributeCore; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2206'; |
3
|
|
|
|
|
|
|
|
4
|
450
|
|
|
450
|
|
3238
|
use strict; |
|
450
|
|
|
|
|
1033
|
|
|
450
|
|
|
|
|
13512
|
|
5
|
450
|
|
|
450
|
|
2374
|
use warnings; |
|
450
|
|
|
|
|
1023
|
|
|
450
|
|
|
|
|
12084
|
|
6
|
|
|
|
|
|
|
|
7
|
450
|
|
|
450
|
|
2450
|
use Scalar::Util 'blessed'; |
|
450
|
|
|
|
|
1108
|
|
|
450
|
|
|
|
|
22571
|
|
8
|
|
|
|
|
|
|
|
9
|
450
|
|
|
450
|
|
3133
|
use parent 'Class::MOP::Mixin'; |
|
450
|
|
|
|
|
1405
|
|
|
450
|
|
|
|
|
3194
|
|
10
|
|
|
|
|
|
|
|
11
|
86247
|
|
|
86247
|
|
316180
|
sub has_accessor { defined $_[0]->{'accessor'} } |
12
|
86313
|
|
|
86313
|
|
360416
|
sub has_reader { defined $_[0]->{'reader'} } |
13
|
86206
|
|
|
86206
|
|
277196
|
sub has_writer { defined $_[0]->{'writer'} } |
14
|
86204
|
|
|
86204
|
|
273273
|
sub has_predicate { defined $_[0]->{'predicate'} } |
15
|
86202
|
|
|
86202
|
|
230378
|
sub has_clearer { defined $_[0]->{'clearer'} } |
16
|
74962
|
|
|
74962
|
|
185300
|
sub has_builder { defined $_[0]->{'builder'} } |
17
|
347
|
|
|
347
|
|
4741
|
sub has_init_arg { defined $_[0]->{'init_arg'} } |
18
|
119650
|
|
|
119650
|
|
361595
|
sub has_default { exists $_[0]->{'default'} } |
19
|
284223
|
|
|
284223
|
|
903438
|
sub has_initializer { defined $_[0]->{'initializer'} } |
20
|
0
|
|
|
0
|
|
0
|
sub has_insertion_order { defined $_[0]->{'insertion_order'} } |
21
|
|
|
|
|
|
|
|
22
|
57509
|
|
|
57509
|
|
118294
|
sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } |
23
|
|
|
|
|
|
|
|
24
|
100
|
100
|
|
100
|
0
|
263
|
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
|
90960
|
100
|
|
90960
|
0
|
223130
|
my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; |
31
|
|
|
|
|
|
|
|
32
|
90960
|
100
|
|
|
|
213623
|
return unless ref($value); |
33
|
|
|
|
|
|
|
|
34
|
66445
|
|
66
|
|
|
236050
|
return ref($value) eq 'CODE' |
35
|
|
|
|
|
|
|
|| ( blessed($value) && $value->isa('Class::MOP::Method') ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub default { |
39
|
175401
|
|
|
175401
|
0
|
281522
|
my ( $self, $instance ) = @_; |
40
|
175401
|
100
|
100
|
|
|
351907
|
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
|
27841
|
|
|
|
|
96712
|
return $self->{'default'}->($instance); |
45
|
|
|
|
|
|
|
} |
46
|
147560
|
|
|
|
|
358459
|
$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.2206 |
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 |