Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Listing all of the perl modules installed

by kejohm (Hermit)
on Oct 29, 2010 at 03:09 UTC ( #868212=note: print w/replies, xml ) Need Help??

in reply to Listing all of the perl modules installed

You could try using the ExtUtils::Installed and Module::CoreList modules. Here is an example that finds all modules and displays the version numbers of each:

#!perl use strict; use warnings; use feature qw(:5.12); use ExtUtils::Installed; use Module::CoreList; use Module::Info; my $inst = ExtUtils::Installed->new(); my $count = 0; my %modules; foreach ( $inst->modules() ) { next if m/^[[:lower:]]/; # skip pragmas next if $_ eq 'Perl'; # core modules aren't present in this +list, # instead coming under the name Perl my $version = $inst->version($_); $version = $version->stringify if ref $version; # version may be r +eturned as # a version object $modules{$_} = { name => $_, version => $version }; $count++; } foreach ( Module::CoreList->find_modules() ) { next if m/^[[:lower:]]/; # skip pragmas my $module = Module::Info->new_from_module($_) or next; $modules{$_} = { name => $_, version => $module->version // q(???) + }; $count++; } foreach ( sort keys %modules ) { say "$_ v$modules{$_}{version}"; } say "\nModules: $count"; __END__

Update: Links fixed.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2020-11-29 08:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found