line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
106
|
|
|
106
|
|
2116
|
use 5.010001; |
|
106
|
|
|
|
|
395
|
|
2
|
106
|
|
|
106
|
|
628
|
use strict; |
|
106
|
|
|
|
|
245
|
|
|
106
|
|
|
|
|
13718
|
|
3
|
106
|
|
|
106
|
|
581
|
use warnings; |
|
106
|
|
|
|
|
248
|
|
|
106
|
|
|
|
|
5097
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -all; |
6
|
106
|
|
|
106
|
|
701
|
|
|
106
|
|
|
|
|
221
|
|
|
106
|
|
|
|
|
801
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.010008'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has file => |
11
|
|
|
|
|
|
|
is => ro, |
12
|
|
|
|
|
|
|
isa => Path, |
13
|
|
|
|
|
|
|
coerce => true, |
14
|
|
|
|
|
|
|
required => true; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has classes => |
17
|
|
|
|
|
|
|
is => ro, |
18
|
|
|
|
|
|
|
isa => HashRef[MiteClass], |
19
|
|
|
|
|
|
|
default => sub { {} }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has class_order => |
22
|
|
|
|
|
|
|
is => ro, |
23
|
|
|
|
|
|
|
isa => ArrayRef[NonEmptyStr], |
24
|
|
|
|
|
|
|
default => sub { [] }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has compiled => |
27
|
|
|
|
|
|
|
is => ro, |
28
|
|
|
|
|
|
|
isa => MiteCompiled, |
29
|
|
|
|
|
|
|
lazy => true, |
30
|
|
|
|
|
|
|
default => sub { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
return Mite::Compiled->new( source => $self ); |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has project => |
36
|
|
|
|
|
|
|
is => rw, |
37
|
|
|
|
|
|
|
isa => MiteProject, |
38
|
|
|
|
|
|
|
# avoid a circular dep with Mite::Project |
39
|
|
|
|
|
|
|
weak_ref => true; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Mite::Compiled; |
42
|
106
|
|
|
106
|
|
42378
|
use Mite::Class; |
|
106
|
|
|
|
|
282
|
|
|
106
|
|
|
|
|
2959
|
|
43
|
106
|
|
|
106
|
|
54183
|
|
|
106
|
|
|
|
|
323
|
|
|
106
|
|
|
|
|
46753
|
|
44
|
|
|
|
|
|
|
my ( $self, $name ) = ( shift, @_ ); |
45
|
|
|
|
|
|
|
|
46
|
50
|
|
|
50
|
0
|
886
|
return defined $self->classes->{$name}; |
47
|
|
|
|
|
|
|
} |
48
|
50
|
|
|
|
|
393
|
|
49
|
|
|
|
|
|
|
my $self = shift; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return $self->compiled->compile(); |
52
|
0
|
|
|
0
|
0
|
0
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
0
|
# Add an existing class instance to this source |
55
|
|
|
|
|
|
|
my ( $self, @classes ) = ( shift, @_ ); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
for my $class (@classes) { |
58
|
|
|
|
|
|
|
$class->source($self); |
59
|
1
|
|
|
1
|
0
|
11
|
|
60
|
|
|
|
|
|
|
next if $self->classes->{$class->name}; |
61
|
1
|
|
|
|
|
3
|
$self->classes->{$class->name} = $class; |
62
|
2
|
|
|
|
|
9
|
push @{ $self->class_order }, $class->name; |
63
|
|
|
|
|
|
|
} |
64
|
2
|
50
|
|
|
|
9
|
|
65
|
2
|
|
|
|
|
7
|
return; |
66
|
2
|
|
|
|
|
3
|
} |
|
2
|
|
|
|
|
7
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Create or reuse a class instance for this source give a name |
69
|
1
|
|
|
|
|
2
|
my ( $self, $name, $metaclass ) = ( shift, @_ ); |
70
|
|
|
|
|
|
|
$metaclass ||= 'Mite::Class'; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
if ( not $self->classes->{$name} ) { |
73
|
|
|
|
|
|
|
eval "require $metaclass"; |
74
|
159
|
|
|
159
|
0
|
823
|
$self->classes->{$name} = $metaclass->new( |
75
|
159
|
|
100
|
|
|
584
|
name => $name, |
76
|
|
|
|
|
|
|
source => $self, |
77
|
159
|
100
|
|
|
|
859
|
); |
78
|
156
|
|
|
|
|
9497
|
push @{ $self->class_order }, $name; |
79
|
156
|
|
|
|
|
1446
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return $self->classes->{$name}; |
82
|
|
|
|
|
|
|
} |
83
|
156
|
|
|
|
|
435
|
|
|
156
|
|
|
|
|
719
|
|
84
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
159
|
|
|
|
|
1314
|
my $joined = join "\n", |
87
|
|
|
|
|
|
|
map { $self->classes->{$_}->_compile_mop } |
88
|
|
|
|
|
|
|
@{ $self->class_order }; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
0
|
|
|
while ( $joined =~ /\n\n/ ) { |
91
|
|
|
|
|
|
|
$joined =~ s/\n\n/\n/g; |
92
|
|
|
|
|
|
|
} |
93
|
0
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return sprintf <<'CODE', B::perlstring( "$name" ), $joined; |
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
require %s; |
96
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
%s |
98
|
|
|
|
|
|
|
CODE |
99
|
|
|
|
|
|
|
} |
100
|
0
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |