Skip to content

Instantly share code, notes, and snippets.

@briandfoy
Created August 23, 2013 03:32
Show Gist options
  • Save briandfoy/6315275 to your computer and use it in GitHub Desktop.
Save briandfoy/6315275 to your computer and use it in GitHub Desktop.
#!perl
use v5.14;
use strict;
use Module::Extract::Namespaces;
LINE: while( <> ) {
chomp;
my @namespaces = Module::Extract::Namespaces->from_file($_);
if( @namespaces == 1 ) {
my $file = $namespaces[0] =~ s/::/\//g;
$file .= '.pm';
next LINE if /\Q$file\E\Z/;
}
my $said = 0;
my %Seen;
foreach my $n ( @namespaces ) {
my $file = $n =~ s/::/\//rg;
$file .= '.pm';
next if /\Q$file\E\Z/;
next if $Seen{$n}++;
say unless $said++;
print "\t$n\n";
}
print "\n" if $said;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment