#!/usr/bin/perl -w

use strict;

my $check = "0";

# Modules to check
my @modCheck = qw(
  HTML::Entities
  LWP::UserAgent
  SOAP::Lite
  File::Temp
  Image::Magick
  Storable
  MIME::Base64
);

for (@modCheck) {
  if (installed("$_")) {
    print "$_ installed (version ",$check,")\n"
  } else {
    print "$_ NOT installed.\n"
  }
}

sub installed {
  my $module = $_;

  # Try to use/load the Perl module
  eval "use $module";

  # Check eval response
  if ($@) {
    # Eval failed, so not installed
    $check = 0;
  } else {
    # Module is installed (reset module version to '1')
    $check = 1;

    my $version = 0;
    # Try to retrieve version number
    eval "\$version = \$$module\::VERSION";
	
    # Set version number if no problem occured
    $check = $version if (!$@);
  }
      
  # Return version number
  return $check;
}

exit();

# The end
