mribizli has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Does anyone know a painless method on accessing to all included perl modules in a perl file. So what I am looking for it is a function or whatever, which has an input parameter a perl file name and gives back all the included module names and of course recursively :) Thanks in advance Ribizli

Replies are listed 'Best First'.
Re: List of all included modules
by Joost (Canon) on Jul 29, 2004 at 17:08 UTC
Re: List of all included modules
by Fletch (Bishop) on Jul 29, 2004 at 17:48 UTC
Re: List of all included modules
by sweetblood (Prior) on Jul 29, 2004 at 17:18 UTC
    Here's what I do:
    #!/usr/bin/perl -w use strict; use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) { my $version = $instmod->version($module) || "???"; print " $module -- $version\n"; }
    HTH

    Update: Please ignore, I mis-read op. The above returns the modules in a perl installation and the vesion numbers.

    Sweetblood