vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

How can I check whether a Perl module is already installed or not, before going to install a new module. please give any way to check it.

Replies are listed 'Best First'.
Re: perl module Checking
by ikegami (Patriarch) on Feb 23, 2009 at 04:12 UTC

    Just try it.

    >perl -e"use Data::Dumper" >perl -e"use Data::Flumper" Can't locate Data/Flumper.pm in @INC (@INC contains ...) at -e line 1. BEGIN failed--compilation aborted at -e line 1.

    A quick way to check the version is to require a high version.

    >perl -e"use Data::Dumper 99" Data::Dumper version 99 required--this is only version 2.121_14 at -e +line 1. BEGIN failed--compilation aborted at -e line 1.
Re: perl module Checking
by toolic (Bishop) on Feb 23, 2009 at 04:15 UTC
    Assuming you know the name of the module, and assuming a *nix OS:
    $ perl -MXML::Twig -e 1

    will return nothing if XML::Twig is installed, or it will complain if it is not installed. See perlrun.