App::Module::Lister - List the Perl modules in @INC
# run the .pm file prompt> perl Lister.pm ---OR--- # rename this file to something your webserver will treat as a # CGI script and upload it. Run it to see the module list prompt> cp Lister.pm lister.cgi ... modify the shebang line if you must prompt> ftp www.example.com ... upload file prompt> wget http://www.example.com/cgi-bin/lister.cgi
This is a program to list all of the Perl modules it finds in @INC for a no-shell web hosting account. It has these explicit design goals:
@INC
Is a single file FTP upload such that it's ready to run (no archives)
Runs as a CGI script
Runs on a standard Perl 5.004 system with no non-core modules
Does not use CPAN.pm (which can't easly be configured without the shell)
If you have a shell account, you should just use CPAN.pm's autobundle feature.
CPAN.pm
You do not need to install this module. You just need the .pm file. The rest of the distribution is there to help me give it to other people and test it.
.pm
You might have to modify the shebang line (the first line in the file) to point to Perl. Your web hoster probably has instructions on what that should be. As shipped, this program uses the env trick described in perlrun. If that doesn't work for you, you'll probably see an error like:
env
/usr/bin/env: bad interpreter: No such file or directory
That's similar to the error you'll see if you have the wrong path to perl.
perl
The program searches each entry in @INC individually and outputs modules as it finds them.
Do the magic, sending the output to FILEHANDLE. By default, it sends the output to STDOUT.
FILEHANDLE
STDOUT
Returns three closures to find, report, and clear a list of modules. See their use in run.
run
Find the $VERSION in FILENAME and return its value. The entire statement in the file must be on a single line with nothing else (just like for the PAUSE indexer). If the version is undefined, it returns the string 'undef'.
$VERSION
FILENAME
'undef'
Used by parse_version_safely to evaluate the $VERSION line and return a number.
parse_version_safely
The STATEMENT is the single statement containing the assignment to $VERSION.
STATEMENT
The SIGIL may be either a $ (for a scalar) or a * for a typeglob.
SIGIL
$
*
The VAR is the variable identifier.
VAR
Turn a PATH into a Perl module name, ignoring the @INC directory specified in INC_DIR.
PATH
INC_DIR
Guessing the module name from the full path name isn't perfect. If I run into directories that aren't part of the module name in one of the @INC directories, this program shows the wrong thing.
For example, I have in @INC the directory /usr/local/lib/perl5/5.8.8. Inside that directory, I expect to find something like /usr/local/lib/perl5/5.8.8/Foo/Bar.pm, which translates in the module Foo::Bar. If I find a directory like /usr/local/lib/perl5/5.8.8/lib/Foo/Bar.pm, where I created the extra lib by hand, this program guesses the module name is lib::Foo::Bar. That's not a great tragedy, but I don't have a simple way around that right now.
/usr/local/lib/perl5/5.8.8
/usr/local/lib/perl5/5.8.8/Foo/Bar.pm
Foo::Bar
/usr/local/lib/perl5/5.8.8/lib/Foo/Bar.pm
lib
lib::Foo::Bar
This program finds all modules, even those installed in multiple locations. It makes no attempt to figure out which ones Perl will choose first.
The CPAN.pm module
This source is in GitHub:
https://github.com/briandfoy/app-module-lister
brian d foy, <briandfoy@pobox.com>
<briandfoy@pobox.com>
The idea and some of the testing came from Adam Wohld.
Some bits stolen from mldistwatch in the PAUSE code, by Andreas König.
mldistwatch
Copyright © 2007-2024, brian d foy <briandfoy@pobox.com>. All rights reserved.
You may redistribute this under the terms of the Artistic 2 license.
To install App::Module::Lister, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Module::Lister
CPAN shell
perl -MCPAN -e shell install App::Module::Lister
For more information on module installation, please visit the detailed CPAN module installation guide.