in reply to find module name from the module archive

Hi Lotus1,

I am not a CPAN expert, but based on what I've seen I'm not sure if there is necessarily a relationship between the name of the CPAN package and the modules contained within. Take for example LWP: it's in  libwww-perl. The only two things I can think of at the moment are to scan the lib/ subdirectory within the .tar.gz, but that might not be perfectly reliable, or to look at http://www.cpan.org/modules/02packages.details.txt (gzipped) to figure out which modules are in which packages. Both don't "feel" particularly clean, so since it's Friday evening it's very possible there's something better I'm missing ;-) (Update: Yep, see Corion's post)

Update: I briefly checked on how CPAN tests for whether a module is installed or not, and from what I can tell it simply scans @INC for the file (using the usual pattern that Foo::Bar::Quz becomes Foo/Bar/Quz.pm).

Regards,
-- Hauke D

Replies are listed 'Best First'.
Re^2: find module name from the module archive
by Lotus1 (Vicar) on Dec 11, 2016 at 21:03 UTC

    Thanks for the suggestion about 02packages.details.txt. I forgot to mention that I'm in a behind the firewall situation where I can't use CPAN so I've written an install script to run through the Makefile.PL, and dmake steps for me. But after a few years and a mix of old and new servers I need to check which modules are already installed. In the near future I plan to add my own local CPAN mirror.