line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
107
|
|
|
107
|
|
2264
|
use 5.010001; |
|
107
|
|
|
|
|
413
|
|
2
|
107
|
|
|
107
|
|
660
|
use strict; |
|
107
|
|
|
|
|
300
|
|
|
107
|
|
|
|
|
2657
|
|
3
|
107
|
|
|
107
|
|
886
|
use warnings; |
|
107
|
|
|
|
|
297
|
|
|
107
|
|
|
|
|
5296
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -all; |
6
|
107
|
|
|
107
|
|
825
|
|
|
107
|
|
|
|
|
285
|
|
|
107
|
|
|
|
|
1224
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.011000'; |
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
|
107
|
|
|
107
|
|
44809
|
use Mite::Class; |
|
107
|
|
|
|
|
347
|
|
|
107
|
|
|
|
|
3511
|
|
43
|
107
|
|
|
107
|
|
44135
|
|
|
107
|
|
|
|
|
1329
|
|
|
107
|
|
|
|
|
52967
|
|
44
|
|
|
|
|
|
|
my ( $self, $name ) = ( shift, @_ ); |
45
|
|
|
|
|
|
|
|
46
|
44
|
|
|
44
|
0
|
825
|
return defined $self->classes->{$name}; |
47
|
|
|
|
|
|
|
} |
48
|
44
|
|
|
|
|
389
|
|
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
|
8
|
|
60
|
|
|
|
|
|
|
next if $self->classes->{$class->name}; |
61
|
1
|
|
|
|
|
4
|
$self->classes->{$class->name} = $class; |
62
|
2
|
|
|
|
|
7
|
push @{ $self->class_order }, $class->name; |
63
|
|
|
|
|
|
|
} |
64
|
2
|
50
|
|
|
|
8
|
|
65
|
2
|
|
|
|
|
8
|
return; |
66
|
2
|
|
|
|
|
5
|
} |
|
2
|
|
|
|
|
7
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Create or reuse a class instance for this source give a name |
69
|
1
|
|
|
|
|
4
|
my ( $self, $name, $metaclass ) = ( shift, @_ ); |
70
|
|
|
|
|
|
|
$metaclass ||= 'Mite::Class'; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
if ( not $self->classes->{$name} ) { |
73
|
|
|
|
|
|
|
eval "require $metaclass"; |
74
|
151
|
|
|
151
|
0
|
878
|
$self->classes->{$name} = $metaclass->new( |
75
|
151
|
|
100
|
|
|
882
|
name => $name, |
76
|
|
|
|
|
|
|
source => $self, |
77
|
151
|
100
|
|
|
|
1117
|
); |
78
|
148
|
|
|
|
|
9733
|
push @{ $self->class_order }, $name; |
79
|
148
|
|
|
|
|
1521
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return $self->classes->{$name}; |
82
|
|
|
|
|
|
|
} |
83
|
148
|
|
|
|
|
378
|
|
|
148
|
|
|
|
|
855
|
|
84
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
85
|
|
|
|
|
|
|
|
86
|
151
|
|
|
|
|
1315
|
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; |