line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package DataCube::FileUtils::CubeMerger; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1288
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
7
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
622
|
use DataCube::FileUtils; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use DataCube::FileUtils::TableMerger; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $utils = DataCube::FileUtils->new; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
|
|
|
|
|
|
my($class,%opts) = @_; |
16
|
|
|
|
|
|
|
bless {%opts}, ref($class) || $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub merge { |
20
|
|
|
|
|
|
|
my($self,%opts) = @_; |
21
|
|
|
|
|
|
|
my $source = $opts{source}; |
22
|
|
|
|
|
|
|
my $target = $opts{target}; |
23
|
|
|
|
|
|
|
my $unlink = $opts{unlink} || 0; |
24
|
|
|
|
|
|
|
die "DataCube::FileUtils::CubeMerger(merge | opts):\nneed a source and target directory to merge:\n$!" |
25
|
|
|
|
|
|
|
unless -d($source) && -d($target); |
26
|
|
|
|
|
|
|
my @tables = grep { /^[a-f0-9]{32}$/i } $utils->dir($source); |
27
|
|
|
|
|
|
|
for(@tables){ |
28
|
|
|
|
|
|
|
die "DataCube::FileUtils::CubeMerger(merge | tables):\n". |
29
|
|
|
|
|
|
|
"found missaligned tables in source and target\n$source/$_\n$target/$_\n$!" |
30
|
|
|
|
|
|
|
unless -d("$target/$_"); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
my $table_merger = DataCube::FileUtils::TableMerger->new; |
33
|
|
|
|
|
|
|
for(@tables){ |
34
|
|
|
|
|
|
|
$table_merger->merge ( |
35
|
|
|
|
|
|
|
source => $source, |
36
|
|
|
|
|
|
|
target => $target, |
37
|
|
|
|
|
|
|
unlink => $unlink, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__DATA__ |