使用Visual Studio,可以建立依赖关系图。这是一个相当酷的功能。
我的问题集中在Perl ---存在一个适合Perl模块的工具吗?
答案 0 :(得分:9)
如果您(只是)想要显示/找到它们use ScanDeps
通过命令行程序scandeps.pl:
% scandeps.pl *.pm # Print PREREQ_PM section for *.pm
% scandeps.pl -e "use utf8" # Read script from command line
% scandeps.pl -B *.pm # Include core modules
% scandeps.pl -V *.pm # Show autoload/shared/data files
在程序中使用;
use Module::ScanDeps;
# standard usage
my $hash_ref = scan_deps(
files => [ 'a.pl', 'b.pl' ],
recurse => 1,
);
# shorthand; assume recurse == 1
my $hash_ref = scan_deps( 'a.pl', 'b.pl' );
# App::Packer::Frontend compatible interface
# see App::Packer::Frontend for the structure returned by get_files
my $scan = Module::ScanDeps->new;
$scan->set_file( 'a.pl' );
$scan->set_options( add_modules => [ 'Test::More' ] );
$scan->calculate_info;
my $files = $scan->get_files;
如果你想在漂亮的图形/树use GraphViz2
中显示它们此外,为了扫描CPAN依赖关系,您可以尝试http://deps.cpantesters.org/ ..
更多选项是:
CPAN::FindDependencies - 在CPAN上找到模块的依赖关系
use CPAN::FindDependencies;
my @dependencies = CPAN::FindDependencies::finddeps("CPAN");
foreach my $dep (@dependencies) {
print ' ' x $dep->depth();
print $dep->name().' ('.$dep->distribution().")\n";
}
Module::Extract::Use - 拉出模块使用的模块
use Module::Extract::Use;
my $extor = Module::Extract::Use->new;
my @modules = $extor->get_modules( $file );
if( $extor->error ) { ... }
my $details = $extor->get_modules_with_details( $file );
foreach my $detail ( @$details ) {
printf "%s %s imports %s\n",
$detail->module, $detail->version,
join ' ', @{ $detail->imports }
}
也许this conclusion会照亮你更多......