blob: c3d930c614d1ffe6ea35d812a1c7bf48bdc09ee3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package Test::PMCR;
use strict;
use warnings;
use File::Copy;
use File::Find;
use File::Spec::Functions 'abs2rel', 'catdir';
use File::Temp 'tempdir';
sub setup_temp_dir {
my ($test) = @_;
my $dir = tempdir(CLEANUP => 1);
lib->import($dir);
my $from_base = catdir(qw(t data), $test);
find(sub {
return if $_ eq '.';
if (-d) {
my $from = abs2rel($File::Find::name, $from_base);
my $to = catdir($dir, $from);
mkdir($to) || die "couldn't mkdir: $!";
}
else {
my $from = abs2rel($File::Find::name, $from_base);
my $to = catdir($dir, $from);
copy($_, $to) || die "couldn't copy: $!";
}
}, $from_base);
return $dir;
}
1;
|