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

I have searched for the answer with no luck so far. Forgive the simple question, but is there a perl command line switch that will display all available modules? I'm working on someone else's machine and want to know what I've got to work with besides what perl -V tells me.

Replies are listed 'Best First'.
Re: Command line option to list all modules?
by fenonn (Chaplain) on Aug 10, 2001 at 23:35 UTC
Re: Command line option to list all modules?
by frag (Hermit) on Aug 10, 2001 at 23:21 UTC
    I believe there's another, more standard, way to do it, but this should do what you want:
    use File::Find; $|++; find sub { print "$File::Find::name\n" if $_ =~ /\.pm$/ }, @INC;
    Of course, if you don't have File::Find, try:
    $|++; while (@INC) { my $dir = shift @INC; opendir(MODDIR, $dir) or die "opendir $dir: $!"; @allfiles = readdir MODDIR; foreach (@allfiles) { $file = "$dir/$_"; next if $_ eq '.' or $_ eq '..'; unshift @INC, $file if -d $file; print "$file\n" if $_ =~ m/\.pm$/; } closedir MODDIR; }

    -- Frag.

      If you don't have File::Find, you might consider upgrading to a more recent version of Perl 5 (like, 1996 or later), File::Find is a core module. =)
Re: Command line option to list all modules?
by echo (Pilgrim) on Aug 11, 2001 at 03:24 UTC
    Yet another way to do it is Tom Phoenix's Inside. It works as a CGI or standalone, great if you need to know which modules are available on your ISP account but do not have shell access.
Re: Command line option to list all modules?
by Bucket (Beadle) on Aug 10, 2001 at 23:20 UTC
    I don't think perl will tell you which modules you have available, however, using what you get with 'perl -V', you can look in @INC and see what modules are located there. This will give you some idea of that person has on that machine. Either this, or you can try using a module in a test script to see if it is there. Bucket
Re: Command line option to list all modules?
by Monky Python (Scribe) on Aug 10, 2001 at 23:21 UTC
Re: Command line option to list all modules?
by Brovnik (Hermit) on Aug 11, 2001 at 00:49 UTC
Re: Command line option to list all modules?
by ralphie (Friar) on Aug 11, 2001 at 04:25 UTC
    if, by chance, you are using activestate's perl you can simply use "ppm query".