line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MOP::Mixin::AttributeCore; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2203'; |
3
|
|
|
|
|
|
|
|
4
|
462
|
|
|
462
|
|
3285
|
use strict; |
|
462
|
|
|
|
|
873
|
|
|
462
|
|
|
|
|
12195
|
|
5
|
462
|
|
|
462
|
|
2035
|
use warnings; |
|
462
|
|
|
|
|
850
|
|
|
462
|
|
|
|
|
11387
|
|
6
|
|
|
|
|
|
|
|
7
|
462
|
|
|
462
|
|
2121
|
use Scalar::Util 'blessed'; |
|
462
|
|
|
|
|
907
|
|
|
462
|
|
|
|
|
19174
|
|
8
|
|
|
|
|
|
|
|
9
|
462
|
|
|
462
|
|
2540
|
use parent 'Class::MOP::Mixin'; |
|
462
|
|
|
|
|
1060
|
|
|
462
|
|
|
|
|
2710
|
|
10
|
|
|
|
|
|
|
|
11
|
88623
|
|
|
88623
|
|
277960
|
sub has_accessor { defined $_[0]->{'accessor'} } |
12
|
88689
|
|
|
88689
|
|
323057
|
sub has_reader { defined $_[0]->{'reader'} } |
13
|
88582
|
|
|
88582
|
|
246650
|
sub has_writer { defined $_[0]->{'writer'} } |
14
|
88580
|
|
|
88580
|
|
243521
|
sub has_predicate { defined $_[0]->{'predicate'} } |
15
|
88578
|
|
|
88578
|
|
206545
|
sub has_clearer { defined $_[0]->{'clearer'} } |
16
|
76991
|
|
|
76991
|
|
162976
|
sub has_builder { defined $_[0]->{'builder'} } |
17
|
347
|
|
|
347
|
|
5022
|
sub has_init_arg { defined $_[0]->{'init_arg'} } |
18
|
122819
|
|
|
122819
|
|
317225
|
sub has_default { exists $_[0]->{'default'} } |
19
|
291176
|
|
|
291176
|
|
796619
|
sub has_initializer { defined $_[0]->{'initializer'} } |
20
|
0
|
|
|
0
|
|
0
|
sub has_insertion_order { defined $_[0]->{'insertion_order'} } |
21
|
|
|
|
|
|
|
|
22
|
59039
|
|
|
59039
|
|
105450
|
sub _set_insertion_order { $_[0]->{'insertion_order'} = $_[1] } |
23
|
|
|
|
|
|
|
|
24
|
100
|
100
|
|
100
|
0
|
216
|
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
|
93254
|
100
|
|
93254
|
0
|
193901
|
my ($value) = ref $_[0] ? $_[0]->{'default'} : $_[1]->{'default'}; |
31
|
|
|
|
|
|
|
|
32
|
93254
|
100
|
|
|
|
188441
|
return unless ref($value); |
33
|
|
|
|
|
|
|
|
34
|
68122
|
|
66
|
|
|
211362
|
return ref($value) eq 'CODE' |
35
|
|
|
|
|
|
|
|| ( blessed($value) && $value->isa('Class::MOP::Method') ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub default { |
39
|
180042
|
|
|
180042
|
0
|
250836
|
my ( $self, $instance ) = @_; |
40
|
180042
|
100
|
100
|
|
|
320719
|
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
|
28420
|
|
|
|
|
73875
|
return $self->{'default'}->($instance); |
45
|
|
|
|
|
|
|
} |
46
|
151622
|
|
|
|
|
314188
|
$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.2203 |
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 |