Scanning Dependencies

miyagawa edited this page Mar 8, 2011 · 4 revisions

cpanm 1.4 has the new option --scandeps to scan and show the dependency graph in the console.

NOTE that this option takes into account what you already have in your perl library path, so if you already have Moose, running cpanm --scandeps Foo wouldn't display Moose even if the Foo module depends on Moose.

If you want the dependency tree for a vanilla perl installation, you can combine this option with -L, like:

cpanm -q --scandeps -L /tmp/perl5 Catalyst

which will print all of the non-core dependencies, instead of what you don't have.

Known issues


Using the -L option like this might actually install modules like Module::Build. This is a known issue and see Module::Build with -L for details.


Some distribution that has non-standard configure_requires, such as Dist::Zilla or MojoMojo (or whatever distributions that use Module::Install::Catalyst) might fail to detect the dependencies correctly. The reason for this is that --scandeps won't install any modules during the scanning phase, which leads to Makefile.PL/Build.PL execution error if it requires non standard modules such as File::Copy::Recursive.

The workaround for now is to install these missing modules when running Makefile.PL/Build.PL first to the -L library path and re-run the --scandeps until the error is gone. This issue might be addressed in the future by installing configure_requires modules to another temporary path.