App-perlimports
view release on metacpan or search on metacpan
script/dump-perl-exports view on Meta::CPAN
#!perl
use strict;
use warnings;
use feature qw( say );
use App::perlimports::ExportInspector ();
use Getopt::Long::Descriptive qw( describe_options );
use List::Util qw( max );
use Log::Dispatch ();
use Module::Runtime qw( use_module );
use Pod::Usage qw( pod2usage );
use Text::SimpleTable::AutoWidth ();
my ( $opts, $usage ) = _options();
if ( $opts->version ) {
say $App::perlimports::ExportInspector::VERSION;
exit(0);
}
if ( $opts->help ) {
print $usage;
exit(0);
}
if ( $opts->verbose_help ) {
print STDOUT $usage;
pod2usage({ -exitval => 0 });
}
if ( $opts->libs ) {
unshift @INC, ( split m{,}, $opts->libs );
}
my $logger = Log::Dispatch->new(
outputs => [
[
'Screen',
min_level => $opts->log_level,
newline => 1,
stderr => 1
]
]
);
my $module = $opts->module || shift @ARGV;
if ( !$module ) {
say q{Mandatory parameter 'module' missing};
print $usage;
exit(1);
}
my $ei = App::perlimports::ExportInspector->new(
logger => $logger,
module_name => $module,
);
if ( $ei->is_oo_class ) {
print 'Appears to be an Object Oriented class.' . "\n";
}
if ( @{ $ei->class_isa } ) {
my $t = Text::SimpleTable::AutoWidth->new();
$t->captions( ['ISA'] );
for my $class ( @{ $ei->class_isa } ) {
$t->row($class);
}
print $t->draw;
}
if ( @{ $ei->pkg_isa } ) {
my $t = Text::SimpleTable::AutoWidth->new();
$t->captions( ['Package ISA'] );
for my $class ( @{ $ei->pkg_isa } ) {
$t->row($class);
}
print $t->draw;
}
if ( @{ $ei->at_export_tags } ) {
my %tags = %{ $ei->at_export_tags };
my @keys = keys %tags;
my @headings = ( 'Export Tag', 'Exported Symbols' );
my $col1_width = max map { length($_) } @keys, $headings[0];
my $col2_width = max map { length($_) } map ( { @{$_} } values %tags ),
$headings[1];
my $t = Text::SimpleTable->new(
[ $col1_width, 'Export Tag' ],
( run in 1.159 second using v1.01-cache-2.11-cpan-af0e5977854 )