line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
109
|
|
|
109
|
|
13758
|
use 5.010001; |
|
109
|
|
|
|
|
463
|
|
2
|
109
|
|
|
109
|
|
719
|
use strict; |
|
109
|
|
|
|
|
306
|
|
|
109
|
|
|
|
|
16640
|
|
3
|
109
|
|
|
109
|
|
604
|
use warnings; |
|
109
|
|
|
|
|
371
|
|
|
109
|
|
|
|
|
5847
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Mite::Class; |
6
|
109
|
|
|
109
|
|
873
|
use Mite::Miteception -all; |
|
109
|
|
|
|
|
335
|
|
|
109
|
|
|
|
|
1113
|
|
7
|
|
|
|
|
|
|
extends qw( |
8
|
|
|
|
|
|
|
Mite::Package |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
with qw( |
11
|
|
|
|
|
|
|
Mite::Trait::HasSuperclasses |
12
|
|
|
|
|
|
|
Mite::Trait::HasConstructor |
13
|
|
|
|
|
|
|
Mite::Trait::HasDestructor |
14
|
|
|
|
|
|
|
Mite::Trait::HasAttributes |
15
|
|
|
|
|
|
|
Mite::Trait::HasRoles |
16
|
|
|
|
|
|
|
Mite::Trait::HasMethods |
17
|
|
|
|
|
|
|
Mite::Trait::HasMOP |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
21
|
|
|
|
|
|
|
our $VERSION = '0.012000'; |
22
|
|
|
|
|
|
|
|
23
|
109
|
|
|
109
|
|
839
|
use Path::Tiny; |
|
109
|
|
|
|
|
260
|
|
|
109
|
|
|
|
|
7402
|
|
24
|
109
|
|
|
109
|
|
798
|
use mro; |
|
109
|
|
|
|
|
325
|
|
|
109
|
|
|
|
|
1312
|
|
25
|
109
|
|
|
109
|
|
2537
|
use B (); |
|
109
|
|
|
|
|
276
|
|
|
109
|
|
|
|
|
74280
|
|
26
|
|
|
|
|
|
|
|
27
|
214
|
|
|
214
|
0
|
629
|
sub kind { 'class' } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub class { |
30
|
2
|
|
|
2
|
0
|
14
|
my ( $self, $name ) = ( shift, @_ ); |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
8
|
return $self->project->class($name); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub chained_attributes { |
36
|
67
|
|
|
67
|
0
|
184
|
my ( $self, @classes ) = ( shift, @_ ); |
37
|
|
|
|
|
|
|
|
38
|
67
|
|
|
|
|
138
|
my %attributes; |
39
|
67
|
|
|
|
|
231
|
for my $class (reverse @classes) { |
40
|
141
|
|
|
|
|
273
|
for my $attribute (values %{$class->attributes}) { |
|
141
|
|
|
|
|
407
|
|
41
|
159
|
|
|
|
|
415
|
$attributes{$attribute->name} = $attribute; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
67
|
|
|
|
|
537
|
return \%attributes; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
around all_attributes => sub { |
49
|
|
|
|
|
|
|
my ( $next, $self ) = ( shift, shift ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return $self->$next |
52
|
|
|
|
|
|
|
if not @{ $self->superclasses || [] }; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return $self->chained_attributes( $self->linear_parents ); |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub parents_attributes { |
58
|
6
|
|
|
6
|
0
|
655
|
my $self = shift; |
59
|
|
|
|
|
|
|
|
60
|
6
|
|
|
|
|
34
|
my @parents = $self->linear_parents; |
61
|
6
|
|
|
|
|
24
|
shift @parents; # remove ourselves from the inheritance list |
62
|
6
|
|
|
|
|
28
|
return $self->chained_attributes(@parents); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub extend_method_signature { |
66
|
2
|
|
|
2
|
0
|
9
|
my ($self, $name, %args) = ( shift, @_ ); |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
11
|
my @parents = $self->linear_parents; |
69
|
2
|
|
|
|
|
5
|
shift @parents; # remove ourselves from the inheritance list |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
13
|
my $found_signature; |
72
|
2
|
|
|
|
|
16
|
for my $parent ( @parents ) { |
73
|
2
|
50
|
|
|
|
15
|
if ( $parent->method_signatures->{$name} ) { |
74
|
2
|
|
|
|
|
12
|
$found_signature = $parent->method_signatures->{$name}; |
75
|
2
|
|
|
|
|
4
|
last; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
2
|
50
|
|
|
|
8
|
if ( $found_signature ) { |
80
|
2
|
100
|
|
|
|
16
|
$self->method_signatures->{$name} = %args |
81
|
|
|
|
|
|
|
? $found_signature->clone( %args, class => $self ) |
82
|
|
|
|
|
|
|
: $found_signature; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
else { |
85
|
0
|
|
|
|
|
0
|
croak "Could not find signature for $name in any parent class"; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
2
|
|
|
|
|
8
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
around extend_attribute => sub { |
92
|
|
|
|
|
|
|
my ( $next, $self, %attr_args ) = ( shift, shift, @_ ); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $name = delete $attr_args{name}; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
if ( $self->attributes->{$name} ) { |
97
|
|
|
|
|
|
|
return $self->$next( name => $name, %attr_args ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $parent_attr = $self->parents_attributes->{$name}; |
101
|
|
|
|
|
|
|
croak <<'ERROR', $name, $self->name unless $parent_attr; |
102
|
|
|
|
|
|
|
Could not find an attribute by the name of '%s' to inherit from in %s |
103
|
|
|
|
|
|
|
ERROR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
if ( ref $attr_args{default} ) { |
106
|
|
|
|
|
|
|
$attr_args{_class_for_default} = $self; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$self->add_attribute($parent_attr->clone(%attr_args)); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
return; |
112
|
|
|
|
|
|
|
}; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub _needs_accessors { |
115
|
113
|
|
|
113
|
|
713
|
return true; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _mop_metaclass { |
119
|
0
|
|
|
0
|
|
|
return '$META_CLASS'; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub _mop_attribute_metaclass { |
123
|
0
|
|
|
0
|
|
|
return 'Moose::Meta::Attribute'; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |