line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Mirror; |
2
|
1
|
|
|
1
|
|
31416
|
use base qw(Exporter); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
127
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
1009
|
use File::Copy; |
|
1
|
|
|
|
|
12227
|
|
|
1
|
|
|
|
|
80
|
|
6
|
1
|
|
|
1
|
|
9
|
use File::Find; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
7
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
346
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw( |
10
|
|
|
|
|
|
|
mirror |
11
|
|
|
|
|
|
|
recursive |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub recursive(&@) { |
17
|
0
|
|
|
0
|
0
|
|
my ($code, $src, $dst) = @_; |
18
|
0
|
|
|
|
|
|
my @src = File::Spec->splitdir($src); |
19
|
0
|
0
|
0
|
|
|
|
pop @src unless defined $src[$#src] and $src[$#src] ne ''; |
20
|
0
|
|
|
|
|
|
my $src_level = @src; |
21
|
|
|
|
|
|
|
find({ wanted => sub { |
22
|
0
|
|
|
0
|
|
|
my @src = File::Spec->splitdir($File::Find::name); |
23
|
0
|
|
|
|
|
|
my $from = File::Spec->catfile($src, @src[$src_level .. $#src]); |
24
|
0
|
|
|
|
|
|
my $to = File::Spec->catfile($dst, @src[$src_level .. $#src]); |
25
|
0
|
|
|
|
|
|
$code->($from, $to); |
26
|
|
|
|
|
|
|
}, |
27
|
0
|
|
|
|
|
|
no_chdir => 1, |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
$src, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub mirror { |
34
|
0
|
0
|
|
0
|
0
|
|
recursive { -d $_[0] ? do { mkdir($_[1]) unless -d $_[1] } : copy(@_) } @_; |
|
0
|
0
|
|
0
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |