Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Detecting if a script uses non-standard module

by davido (Cardinal)
on Apr 05, 2004 at 02:36 UTC ( #342556=note: print w/replies, xml ) Need Help??


in reply to Detecting if a script uses non-standard module

I'd be more interested in a log of what modules I've installed. Perhaps one exists that I haven't found. Sometimes those PPM installations load dependancies faster than I can read them as they scroll by.


Dave

  • Comment on Re: Detecting if a script uses non-standard module

Replies are listed 'Best First'.
Re: Re: Detecting if a script uses non-standard module
by Vautrin (Hermit) on Apr 05, 2004 at 04:56 UTC

    All modules are stored in directories contained in the @INC variable. It is not hard to create a perl script to find all modules within those directories. The easiest involves using glob, i.e.:

    foreach my $path (@INC) { my @modules = glob "$path/*.pm"; foreach my $module (@modules) { print "You have module $module installed\n"; } }

    A more elegant solution would involve using File::Find to recursively search the directories, and create the proper names for modules. (For instance, the Net::SMTP module would be called SMTP.pm under the directory Net)


    Want to support the EFF and FSF by buying cool stuff? Click here.
      That doesn't differentiate between which modules were installed as part of the Perl core, and which were installed after the fact. The OP is interested in knowing which modules were bundled with Perl. We already got a pretty good answer; perlmodlib has a mostly up-to-date listing of Perl's core modules. My counter-question was how to determine which modules I've installed that didn't ship with Perl as a core module.

      I guess, to your point, I could use File::Find to resurse Perl's @INC paths, keeping track of the names of all modules found, and then compare that list to the one provided in perlmodlib.


      Dave

        I guess, to your point, I could use File::Find to resurse Perl's @INC paths, keeping track of the names of all modules found, and then compare that list to the one provided in perlmodlib.

        Yes, you could do all sorts of things to this effect. You could take a list of modules which might be installed by default by your Perl distribution and compare it with what is installed. You've solved your own problem. <grins /> I was trying to provide suggestions to see whether or not it helped anyone.


        Want to support the EFF and FSF by buying cool stuff? Click here.
Re: Re: Detecting if a script uses non-standard module
by rinceWind (Monsignor) on Apr 05, 2004 at 14:23 UTC
    perldoc perllocal gives you a list of the modules installed to the site lib directory. I'm not sure how/whether this works with PPM.

    hth

    --
    I'm Not Just Another Perl Hacker

      perllocal is not updated on module deinstall.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://342556]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2022-05-28 05:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (98 votes). Check out past polls.

    Notices?