find-package-conflicts for aggregation conversion abandoned/test-aggregate
Shawn M Moore [Fri, 31 Jul 2009 02:41:27 +0000 (22:41 -0400)]
author/find-package-conflicts [new file with mode: 0755]

diff --git a/author/find-package-conflicts b/author/find-package-conflicts
new file mode 100755 (executable)
index 0000000..29ad722
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use File::Next;
+use File::Slurp 'slurp';
+
+my %files_of;
+
+my $files = File::Next::files('tests/');
+while (defined(my $file = $files->())) {
+    next if $file !~ /\.t$/;
+
+    my $code = slurp $file;
+    while ($code =~ m{package\s+([\w:]+);}g) {
+        push @{ $files_of{$1} }, $file;
+    }
+}
+
+my @packages = sort { @{ $files_of{$a} } <=> @{ $files_of{$b} } }
+               grep { @{ $files_of{$_} } > 1 }
+               keys %files_of;
+
+for my $package (@packages) {
+    printf "%s (%d)\n", $package, scalar @{ $files_of{$package} };
+    print map { "    $_\n" } sort @{ $files_of{$package} };
+}
+