find out whats there and what needs to be added

This is a FAQ (or part of it is, anyway): perlfaq3, "How do I find which modules are installed on my system?"

Nonetheless, it has been asked many times and because TMTOWTDI there are nearly as many different answers. Super Search is your friend. The following results were found using this search:

Additional links can be found within those threads. Lastly, the section in Tutorials entitled Modules: How to Create, Install, and Use may also be of some use.

Here are two example scripts that I found floating around my hard drive. The first uses File::Find to locate installed modules (some may advocate the File::Find::Rule interface instead) and the second uses Module::Info to obtain the version and path information for each module. Once you have that information, you can compare it to your list of dependencies.

Example of File::Find

use strict; use warnings; use File::Find; my $outfile = 'installed_mods.txt'; open( OUTFILE, '>', $outfile ) or die "error opening $outfile: $!\n"; for( @INC ) { find( \&modules, $_ ); } sub modules { if( -d && /^[a-z]/ ) { $File::Find::prune = 1; return; } return unless /\.pm$/; my $fullPath = "$File::Find::dir/$_"; $fullPath =~ s/\.pm$//; $fullPath =~ s[/(\w+)$][::$1]; print OUTFILE "$fullPath\n"; }

Example of Module::Info

use strict; use warnings; use Module::Info; my @mods = Module::Info->all_installed( 'Bit::Vector' ); foreach my $mod ( @mods ) { print join( "\n ", $mod->name, $mod->version, $mod->inc_dir, $mod->file, $mod->is_core ); }

Update: Added Super Search results


In reply to Re: discovering installed packages by bobf
in thread discovering installed packages by ethrbunny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.