4 BEGIN { plan skip_all => "Install Capture::Tiny to test installation"
5 unless eval { require Capture::Tiny; 1 } }
6 use Capture::Tiny qw(capture_merged);
8 use File::Path qw(mkpath);
12 use lib 't/lib'; use TempDir;
19 'PERL_LOCAL_LIB_ROOT',
20 grep /^MAKE/, keys %ENV
32 open my $fh, '>', 'Makefile.PL' or die "can't create Makefile.PL: $!";
33 print $fh 'use ExtUtils::MakeMaker; WriteMakefile( NAME => "EUMM" );';
35 system($^X, 'Makefile.PL') && die "Makefile.PL failed";
36 system($Config{make}, 'install') && die "$Config{make} install failed";
39 open my $fh, '>', 'Build.PL' or die "can't create Build.PL: $!";
40 print $fh <<END_BUILD;
46 )->create_build_script;
49 system($^X, 'Build.PL') && die "Build.PL failed";
50 system($^X, 'Build', 'install') && die "Build install failed";
54 plan tests => @dirs * keys(%dist_types) * 2;
57 for my $dir_base (@dirs) {
58 for my $dist_type (sort keys %dist_types) {
60 my $temp = mk_temp_dir("install-$dist_type-XXXXX");
61 my $ll_dir = "$dist_type-$dir_base";
62 my $ll = "$temp/$ll_dir";
63 mkpath(File::Spec->canonpath($ll));
65 local::lib->import($ll);
67 my $dist_dir = mk_temp_dir("source-$dist_type-XXXXX");
70 open my $fh, '>', "lib/$dist_type.pm";
74 my $output = capture_merged { eval {
75 $dist_types{$dist_type}->();
77 is $@, '', "installed $dist_type into '$ll_dir'"
80 my $dest_dir = local::lib->install_base_perl_path($ll);
81 my $file = File::Spec->catfile($dest_dir, "$dist_type.pm");
82 (my $short_file = $file) =~ s/^\Q$ll/$ll_dir/;
85 "$dist_type - $dir_base - $dist_type.pm installed as '$short_file'",
86 ) or diag 'Files in ' . $dest_dir . ":\n", join("\n", do {
88 (opendir $dh, $dest_dir) ? readdir $dh : "doesn't exist";