Check for Perl Module
Published on 30 Nov 2007Tags #Perl
Sometimes you’ll need to decide on a course of action depending on the presence of a certain module.
-
The way you’d usually pull in a module:
use MODULE qw(SYMBOLS);
-
Instead of pulling in the module:
eval "use MODULE"; if (not $EVAL_ERROR) { # use English: $@ -> $EVAL_ERROR require MODULE; import MODULE qw(SYMBOLS); }