http://www.perlmonks.org?node_id=786769

vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

If I use cpan command It will also install the dependency modules of that module. How do I list a dependency modules of a perl module ? Thanks!

  • Comment on How to find the perl module's dependency modules ?

Replies are listed 'Best First'.
Re: How to find the perl module's dependency modules ?
by moritz (Cardinal) on Aug 07, 2009 at 13:08 UTC
      try Module::ScanDeps ?
Re: How to find the perl module's dependency modules ?
by jettero (Monsignor) on Aug 07, 2009 at 13:08 UTC
    I usually use "look Module::Name" from the cpan shell. Then you get a shell prompt and I either read the Makefile.PL, Build.PL, or execute it (which prints the deps to the terminal).

    -Paul

      I can also see the dependency modules when I install a new perl module, but my expectation is any perl module is available to find the already installed module's dependency modules.

Re: How to find the perl module's dependency modules ?
by ww (Archbishop) on Aug 07, 2009 at 13:21 UTC
Re: How to find the perl module's dependency modules ?
by Khen1950fx (Canon) on Aug 07, 2009 at 19:42 UTC
    These are a few of my favorite things:

    #!/usr/local/bin/perl use strict; use warnings; use CPAN::FindDependencies; use ExtUtils::MakeMaker qw(prompt); my $mod = prompt("Enter module name: "); my @dependencies = CPAN::FindDependencies::finddeps($mod); foreach my $dep (@dependencies) { print ' ' x $dep->depth(); print $dep->name().' ('.$dep->distribution().")\n"; }
    And this:

    #!/usr/local/bin/perl use strict; use warnings; use B::PerlReq; use ExtUtils::MakeMaker qw(prompt); my $mod = prompt("Enter path to .pm: "); my $prereq = system("perl -MO=PerlReq -d $mod"); print "$prereq\n";
    And this:

    #!/usr/local/bin/perl use strict; use warnings; use ExtUtils::MakeMaker qw(prompt); my $mod = prompt("Enter module name: "); my $info = system("module_info -a $mod"); print "$info\n";

      Thanks ! I used first one.