From: Shawn M Moore Date: Fri, 31 Jul 2009 02:41:27 +0000 (-0400) Subject: find-package-conflicts for aggregation conversion X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=820a6a0ca146853e61a408ea9240daca0d99814b;p=gitmo%2FMoose.git find-package-conflicts for aggregation conversion --- diff --git a/author/find-package-conflicts b/author/find-package-conflicts new file mode 100755 index 0000000..29ad722 --- /dev/null +++ b/author/find-package-conflicts @@ -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} }; +} +