From 999ba802d61bdc188858e3c1b9fb0d974f537779 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 7 Nov 2012 09:07:43 +0000 Subject: [PATCH] Fix ModuleManager failing when: - LWP::Simple is not installed. - Crypt::SSLeay or IO::Socket::SSL are not installed. This fixes #154. --- make/configure.pm | 9 ++++++++- modulemanager | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/make/configure.pm b/make/configure.pm index b8e39598a..606483e98 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -31,7 +31,7 @@ use warnings FATAL => qw(all); use Exporter 'import'; use POSIX; use make::utilities; -our @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s); +our @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s module_installed); my $no_git = 0; @@ -193,6 +193,13 @@ sub promptnumeric($$) } } +sub module_installed($) +{ + my $module = shift; + eval("use $module;"); + return !$@; +} + sub promptstring_s($$) { my ($prompt,$default) = @_; diff --git a/modulemanager b/modulemanager index ff2bd3056..d1212faf5 100755 --- a/modulemanager +++ b/modulemanager @@ -21,10 +21,22 @@ use strict; use warnings FATAL => qw(all); -use LWP::Simple; use make::configure; + +if (!module_installed("LWP::Simple")) +{ + die "Your system is missing the LWP::Simple Perl module!"; +} + +if (!module_installed("Crypt::SSLeay") && !module_installed("IO::Socket::SSL")) +{ + die "Your system is missing the Crypt::SSLeay or IO::Socket::SSL Perl modules!"; +} + +use LWP::Simple; + our @modlist; my %installed; -- 2.39.2