NAME
Module::Which - Finds out which version of Perl modules are installed
SYNOPSIS
use Module::Which;
my $info = which('Module::Which', 'YAML', 'XML::*', 'DBI', 'DBD::*');
while (my ($mod, $info) = each %$info) {
print "$mod: $info->{version}\n";
}
DESCRIPTION
Module::Which
is the basis of the script which_pm
intented to show which version of a Perl module is installed (if it is there at all).
Modules are searched by name (like 'YAML') or by subcategories ('DBD::*' means all modules under the DBD subdirectories of your Perl installation, matching both 'DBD::Oracle' and 'DBD::ODBC::Changes').
This module is very simple and most won't need it. But it has been instructive for the author to see how many broken modules one can find under your Perl installation (some which don't accept even a 'require' statement), modules with no version number and documentation files (named '.pm') which do not return a true value.
To find out modules under subcategories, Module::Find by Christian Renz was used.
Well, all that said, this module is no more than automating:
perl -MModule::I::Want::To::Know::About -e "print $Module::I::Want::To::Know::About::VERSION"
or better the one-liner
perl -e '$pm = shift; eval "require $pm"; print ${"${pm}::VERSION"}' DBI
- which
-
my $info = which(@pm)
Returns a hash ref with the modules specified (by name or '::*' patterns) as keys and a hash ref as value (which actually contains only the pair
version =
$v>). The version is the one found by accessing the scalar variable$VERSION
of the package, after a require statement.
EXPORT
which
is exported by default.
SEE ALSO
Module::Find was my friend to implement this module as a breeze.
Please report bugs via CPAN RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module-Which.
AUTHOR
Adriano R. Ferreira, <ferreira@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Adriano R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.