1 package SL::InstallationCheck;
 
   3 use English '-no_match_vars';
 
   6 use vars qw(@required_modules @optional_modules);
 
  11   { name => "parent",                              url => "http://search.cpan.org/~corion/" },
 
  12   { name => "Archive::Zip",                        url => "http://search.cpan.org/~adamk/" },
 
  13   { name => "Class::Accessor",                     url => "http://search.cpan.org/~kasei/" },
 
  14   { name => "CGI::Ajax",                           url => "http://search.cpan.org/~bct/" },
 
  15   { name => "DateTime",                            url => "http://search.cpan.org/~drolsky/" },
 
  16   { name => "DBI",                                 url => "http://search.cpan.org/~timb/" },
 
  17   { name => "DBD::Pg",                             url => "http://search.cpan.org/~dbdpg/" },
 
  18   { name => "Email::Address",                      url => "http://search.cpan.org/~rjbs/" },
 
  19   { name => "FCGI",                                url => "http://search.cpan.org/~mstrout/" },
 
  20   { name => "IO::Wrap",                            url => "http://search.cpan.org/~dskoll/" },
 
  21   { name => "List::MoreUtils",                     url => "http://search.cpan.org/~vparseval/" },
 
  22   { name => "PDF::API2",                           url => "http://search.cpan.org/~areibens/" },
 
  23   { name => "Template",        version => '2.18',  url => "http://search.cpan.org/~abw/" },
 
  24   { name => "Text::CSV_XS",                        url => "http://search.cpan.org/~hmbrand/" },
 
  25   { name => "Text::Iconv",                         url => "http://search.cpan.org/~mpiotr/" },
 
  26   { name => "URI",                                 url => "http://search.cpan.org/~gaas/" },
 
  27   { name => "XML::Writer",                         url => "http://search.cpan.org/~josephw/" },
 
  28   { name => "YAML",                                url => "http://search.cpan.org/~ingy/" },
 
  31 @optional_modules = ();
 
  33 sub module_available {
 
  35   my $version = $_[1] || '' ;
 
  37   if (!defined(eval("require $module $version;"))) {
 
  44 my %conditional_dependencies;
 
  46 sub check_for_conditional_dependencies {
 
  47   if (!$conditional_dependencies{net_ldap}) {
 
  48     $conditional_dependencies{net_ldap} = 1;
 
  50     my $in = IO::File->new('config/authentication.pl', 'r');
 
  55       while (my $line = <$in>) {
 
  64         if ($self->{module} && ($self->{module} eq 'LDAP')) {
 
  65           push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' };
 
  72 sub test_all_modules {
 
  73   return grep { !module_available($_->{name}) } @required_modules;