line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Assets::Kind; |
2
|
|
|
|
|
|
|
|
3
|
23
|
|
|
23
|
|
127
|
use strict; |
|
23
|
|
|
|
|
84
|
|
|
23
|
|
|
|
|
769
|
|
4
|
23
|
|
|
23
|
|
115
|
use warnings; |
|
23
|
|
|
|
|
42
|
|
|
23
|
|
|
|
|
718
|
|
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
114
|
use Object::Tiny qw/kind type head tail/; |
|
23
|
|
|
|
|
46
|
|
|
23
|
|
|
|
|
188
|
|
7
|
23
|
|
|
23
|
|
5496
|
use Carp; |
|
23
|
|
|
|
|
57
|
|
|
23
|
|
|
|
|
10898
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
205
|
|
|
205
|
0
|
2148
|
my $self = bless {}, shift; |
11
|
205
|
50
|
|
|
|
983
|
confess "Uhh, whut?" unless $self->{kind} = my $kind = shift; |
12
|
205
|
|
|
|
|
739
|
my @kind = split m/-/, $kind, 2; |
13
|
205
|
|
|
|
|
318
|
my $type = shift; |
14
|
205
|
100
|
|
|
|
549
|
unless ($type) { |
15
|
17
|
|
|
|
|
32
|
$type = $kind[0]; |
16
|
17
|
|
|
|
|
95
|
$type = File::Assets::Util->parse_type($type); |
17
|
|
|
|
|
|
|
} |
18
|
205
|
|
|
|
|
66350
|
$self->{type} = $type; |
19
|
205
|
100
|
|
|
|
591
|
$kind[1] = "" unless defined $kind[1]; |
20
|
205
|
|
|
|
|
446
|
$self->{tail} = my $tail = $kind[1]; |
21
|
205
|
|
|
|
|
591
|
$self->{head} = ($type->extensions)[0]; |
22
|
|
|
|
|
|
|
|
23
|
205
|
|
|
|
|
1836
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub extension { |
27
|
65
|
|
|
65
|
0
|
376
|
my $self = shift; |
28
|
65
|
|
|
|
|
1460
|
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
|
7
|
my $self = shift; |
42
|
4
|
|
|
|
|
8
|
my $other = shift; |
43
|
|
|
|
|
|
|
|
44
|
4
|
50
|
|
|
|
117
|
return 0 unless File::Assets::Util->same_type($self->type, $other->type); |
45
|
4
|
|
|
|
|
141
|
my $self_tail = $self->tail; |
46
|
4
|
|
|
|
|
107
|
my $other_tail = $other->tail; |
47
|
4
|
100
|
100
|
|
|
32
|
if (length $self_tail && length $other_tail) { |
48
|
2
|
100
|
66
|
|
|
61
|
return 0 unless 0 == index($self->tail, $other->tail) || 0 == index($other->tail, $self->tail); |
49
|
|
|
|
|
|
|
} |
50
|
3
|
|
|
|
|
78
|
return length $self->tail > length $other->tail; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |