This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't try to export symbols that don't exist
[perl5.git] / t / lib / MakeMaker / Test / Setup / Recurs.pm
CommitLineData
3377b245
JH
1package MakeMaker::Test::Setup::Recurs;
2
3@ISA = qw(Exporter);
4require Exporter;
5@EXPORT = qw(setup_recurs teardown_recurs);
6
7use strict;
8use File::Path;
9use File::Basename;
10
11my %Files = (
12 'Recurs/Makefile.PL' => <<'END',
13use ExtUtils::MakeMaker;
14
15WriteMakefile(
16 NAME => 'Recurs',
17 VERSION => 1.00,
18);
19END
20
21 'Recurs/prj2/Makefile.PL' => <<'END',
22use ExtUtils::MakeMaker;
23
24WriteMakefile(
25 NAME => 'Recurs::prj2',
26 VERSION => 1.00,
27);
28END
29 );
30
31sub setup_recurs {
32 while(my($file, $text) = each %Files) {
33 # Convert to a relative, native file path.
34 $file = File::Spec->catfile(File::Spec->curdir, split m{\/}, $file);
35
36 my $dir = dirname($file);
37 mkpath $dir;
38 open(FILE, ">$file") || die "Can't create $file: $!";
39 print FILE $text;
40 close FILE;
41 }
42
43 return 1;
44}
45
46sub teardown_recurs {
47 foreach my $file (keys %Files) {
48 my $dir = dirname($file);
49 if( -e $dir ) {
50 rmtree($dir) || return;
51 }
52 }
53 return 1;
54}
a7d1454b
RGS
55
56
571;