line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
2
|
|
|
|
|
|
|
package Swim::Util; |
3
|
1
|
|
|
1
|
|
489
|
use Encode; |
|
1
|
|
|
|
|
8246
|
|
|
1
|
|
|
|
|
219
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub merge_meta { |
6
|
0
|
|
|
0
|
0
|
|
require YAML::XS; |
7
|
0
|
|
|
|
|
|
require Hash::Merge; |
8
|
0
|
|
|
|
|
|
my ($class, $meta, $yaml) = @_; |
9
|
0
|
|
|
|
|
|
my $data = eval { |
10
|
0
|
|
|
|
|
|
YAML::XS::Load(Encode::encode 'UTF-8', $yaml); |
11
|
|
|
|
|
|
|
}; |
12
|
0
|
0
|
|
|
|
|
if ($@) { |
13
|
0
|
|
|
|
|
|
warn "Swim meta failed to load:\n$@"; |
14
|
0
|
|
|
|
|
|
$data = {}; |
15
|
|
|
|
|
|
|
} |
16
|
0
|
|
|
|
|
|
Hash::Merge::merge($data, $meta); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub slurp { |
20
|
0
|
|
|
0
|
0
|
|
my ($class, $file) = @_; |
21
|
0
|
|
|
|
|
|
local $/; |
22
|
0
|
|
|
|
|
|
my $text; |
23
|
0
|
0
|
|
|
|
|
if (defined $file) { |
24
|
0
|
0
|
|
|
|
|
open my $fh, $file |
25
|
|
|
|
|
|
|
or die "Can't open '$file' for input"; |
26
|
0
|
|
|
|
|
|
binmode($fh, ':encoding(UTF-8)'); |
27
|
0
|
|
|
|
|
|
$text = <$fh>; |
28
|
0
|
|
|
|
|
|
close $fh; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
0
|
|
|
|
|
|
binmode(STDIN, ':encoding(UTF-8)'); |
32
|
0
|
|
|
|
|
|
$text = ; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
return $text; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |