line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Assets::Kind; |
2
|
|
|
|
|
|
|
|
3
|
24
|
|
|
24
|
|
130
|
use strict; |
|
24
|
|
|
|
|
40
|
|
|
24
|
|
|
|
|
768
|
|
4
|
24
|
|
|
24
|
|
114
|
use warnings; |
|
24
|
|
|
|
|
43
|
|
|
24
|
|
|
|
|
664
|
|
5
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
107
|
use Object::Tiny qw/kind type head tail/; |
|
24
|
|
|
|
|
44
|
|
|
24
|
|
|
|
|
121
|
|
7
|
24
|
|
|
24
|
|
5030
|
use Carp; |
|
24
|
|
|
|
|
45
|
|
|
24
|
|
|
|
|
10570
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
212
|
|
|
212
|
0
|
2308
|
my $self = bless {}, shift; |
11
|
212
|
50
|
|
|
|
1133
|
confess "Uhh, whut?" unless $self->{kind} = my $kind = shift; |
12
|
212
|
|
|
|
|
901
|
my @kind = split m/-/, $kind, 2; |
13
|
212
|
|
|
|
|
361
|
my $type = shift; |
14
|
212
|
100
|
|
|
|
567
|
unless ($type) { |
15
|
17
|
|
|
|
|
30
|
$type = $kind[0]; |
16
|
17
|
|
|
|
|
93
|
$type = File::Assets::Util->parse_type($type); |
17
|
|
|
|
|
|
|
} |
18
|
212
|
|
|
|
|
53198
|
$self->{type} = $type; |
19
|
212
|
100
|
|
|
|
601
|
$kind[1] = "" unless defined $kind[1]; |
20
|
212
|
|
|
|
|
433
|
$self->{tail} = my $tail = $kind[1]; |
21
|
212
|
|
|
|
|
678
|
$self->{head} = ($type->extensions)[0]; |
22
|
|
|
|
|
|
|
|
23
|
212
|
|
|
|
|
1926
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub extension { |
27
|
65
|
|
|
65
|
0
|
402
|
my $self = shift; |
28
|
65
|
|
|
|
|
1458
|
return ($self->type->extensions)[0]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub is_better_than_or_equal { |
32
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
33
|
0
|
|
|
|
|
0
|
my $other = shift; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
0
|
return 1 if $self->kind eq $other->kind; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
return $self->is_better_than($other); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub is_better_than { |
41
|
4
|
|
|
4
|
0
|
6
|
my $self = shift; |
42
|
4
|
|
|
|
|
7
|
my $other = shift; |
43
|
|
|
|
|
|
|
|
44
|
4
|
50
|
|
|
|
111
|
return 0 unless File::Assets::Util->same_type($self->type, $other->type); |
45
|
4
|
|
|
|
|
184
|
my $self_tail = $self->tail; |
46
|
4
|
|
|
|
|
105
|
my $other_tail = $other->tail; |
47
|
4
|
100
|
100
|
|
|
36
|
if (length $self_tail && length $other_tail) { |
48
|
2
|
100
|
66
|
|
|
56
|
return 0 unless 0 == index($self->tail, $other->tail) || 0 == index($other->tail, $self->tail); |
49
|
|
|
|
|
|
|
} |
50
|
3
|
|
|
|
|
76
|
return length $self->tail > length $other->tail; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |