4 # cmpVERSION - compare two Perl source trees for modules
5 # that have identical version numbers but different contents.
7 # Original by slaven@rezic.de, modified by jhi.
12 use ExtUtils::MakeMaker;
15 use File::Spec::Functions qw(rel2abs abs2rel catfile catdir curdir);
18 die "$0: '$_' does not look like Perl directory\n"
19 unless -f catfile($_, "perl.h") && -d catdir($_, "Porting");
22 my $dir2 = rel2abs($ARGV[1]);
23 chdir $ARGV[0] or die "$0: chdir '$ARGV[0]' failed: $!\n";
25 # Files to skip from the check for one reason or another,
26 # usually because they pull in their version from some other file.
29 './lib/Carp/Heavy.pm',
30 './lib/Exporter/Heavy.pm'
36 ! exists $skip{$File::Find::name}
39 catfile(catdir($dir2, $File::Find::dir), $_);
40 (my $xs_file1 = $_) =~ s/\.pm$/.xs/;
41 (my $xs_file2 = $file2) =~ s/\.pm$/.xs/;
42 if (-e $xs_file1 && -e $xs_file2) {
43 return if compare($_, $file2) == 0 &&
44 compare($xs_file1, $xs_file2) == 0;
46 return if compare($_, $file2) == 0;
48 my $version1 = eval {MM->parse_version($_)};
49 my $version2 = eval {MM->parse_version($file2)};
50 push @wanted, $File::Find::name
51 if defined $version1 &&
53 $version1 eq $version2
55 print map { $_, "\n" } sort @wanted;