in reply to how to determine whether a module is installed or not?

Something like:

if (eval {require 'Text/LevenshteinXS.pm'}) { Text::LevenshteinXS::import('distance'); } elsif (eval {require 'Text/Levenshtein.pm'}) { Text::Levenshtein::import('distance'); } else { *distance = \&myDistanceSub; }
True laziness is hard work

Replies are listed 'Best First'.
Re^2: how to determine whether a module is installed or not?
by slayedbylucifer (Scribe) on Dec 28, 2010 at 06:50 UTC

    I found this on Google. this perl oneliner will list all the installed modules on your system (Linux). then you can grep for whatever module your are looking for.

    perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => + sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
      That is an extremely inefficient solution.