#!/usr/bin/perl -w
# test_perl_modules.pl copyright 2003 Alessandro Razeto <eto@linux.it>
# distribuited under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.


my $name=$ARGV[0];
$name=~s/-[^-]*$//;


# Set Uppercase letter for each word after the ::
my @name_components = split (/-/, $name);
my @new_name_components;
foreach my $component (@name_components) {
  push @new_name_components, ucfirst $component;
}
$name = join "::", @new_name_components;

# Look name with not trivial mapping
my %nontrivial_lookup = ( "MailTools" => "Mail::Send", "MIME::Tools" => "MIME::Parser", "Gettext" => "Locale::gettext", "Perl::Ldap" => "Net::LDAP" );
foreach my $key (keys %nontrivial_lookup) {
  if ($name =~ /^$key$/) {
    $name = $nontrivial_lookup{$key};
    last;
  }
}


eval "require $name;";

if ($@) { exit 1; }
else    { exit 0;}
