File: install-pl

package info (click to toggle)
libapache2-mod-perl2 2.0.4-7%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 9,896 kB
  • ctags: 3,820
  • sloc: perl: 56,663; ansic: 14,001; makefile: 93; sh: 38
file content (67 lines) | stat: -rw-r--r-- 2,113 bytes parent folder | download | duplicates (4)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# this is just a helper module for the installation phase, so it can
# be re-used during the standalone and mod_perl 2.0 install

# it has this unusual filename: install-pl, to prevent MakeMaker from
# installing it system-wide
package Apache::Test::install;

use strict;
use warnings;

use File::Spec::Functions qw(catfile catdir);

# on Case-Insensitive systems Apache/Test.pm can't coexist with
# Apache/test.pm, since Apache::test is now deprecated (was renamed to
# Apache/testold.pm in mod_perl 1.28, we need to find and remove any
# occurrences of this file. CPAN authors should
# s/Apache::test/Apache::testold/ and can either require mod_perl 1.28
# which already carries it or simply bundle it. The best option is to
# port the test suite to use Apache::Test which works with both
# mod_perl generations.
#
# we could have done this cleanup only for case-insensitive systems,
# but I feel that doing it for all systems, will speedup the
# transitions from Apache::test to either Apache::Test or
# Apache::testold.
#
sub nuke_Apache__test_target {

    my $cleanup_packlist = ".mypacklist";

    my @convicts = ();
    foreach (@INC) {
        my $dir = catdir $_, "Apache";
        next unless -d $dir;
        opendir DIR, $dir or die "Cannot opendir $dir: $!\n";
        my @matches = grep /^test.pm$/, readdir DIR;
        closedir DIR;
        push @convicts, map { catfile $dir, $_ } @matches if @matches;
    }

    if (@convicts) {
        print <<EOI;
!!! Makefile.PL has found old copies of Apache/test.pm which will
be removed during 'make install' to prevent collisions with Apache::Test:

@{[join "\n", @convicts]}

CPAN authors are advised to either use Apache::testold or port their
test suite to Apache::Test which works with both mod_perl generations.
EOI
    }

    open PACKLIST, ">$cleanup_packlist"
        or die "Can't open $cleanup_packlist: $!";
    print PACKLIST join "", map "$_\n", @convicts;
    close PACKLIST;

    return <<EOF;

nuke_Apache__test:
\t\$(FULLPERL) -MExtUtils::Install -e \\
\t"-e qq{$cleanup_packlist} && uninstall(qq{$cleanup_packlist}, 1, 0)"
EOF

}

1;