in reply to CoreList stuff
I think you misunderstood what Module::CoreList is for: it tells you about the "core" modules, i.e. the ones that are included by default with any distribution of perl. It's often useful to know when a paticular core module entered the core, if you're trying to support older versions of perl.
A common way of finding out if you have a module is:
If you get a version number, it's there, if not, you don't have it.perl -MSome::Module -e'print $Some::Module::VERSION, "\n"'
From within perl code, I'd be inclined to require it and trap the error to find out if the require failed. Something like this:
use Carp; my $module = "CGI"; eval "require $module"; if ($@) { carp "Problem with require of $module: $@"; } else { print "We have $module installed\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CoreList stuff
by doom (Deacon) on Feb 01, 2009 at 22:30 UTC | |
by Anonymous Monk on Feb 01, 2009 at 23:07 UTC |