1 package SL::InstallationCheck;
 
   3 use English '-no_match_vars';
 
   6 use vars qw(@required_modules @optional_modules);
 
  12   { name => "parent",                              url => "http://search.cpan.org/~corion/" },
 
  13   { name => "Archive::Zip",                        url => "http://search.cpan.org/~adamk/" },
 
  14   { name => "Class::Accessor",                     url => "http://search.cpan.org/~kasei/" },
 
  15   { name => "CGI::Ajax",                           url => "http://search.cpan.org/~bct/" },
 
  16   { name => "DateTime",                            url => "http://search.cpan.org/~drolsky/" },
 
  17   { name => "DBI",                                 url => "http://search.cpan.org/~timb/" },
 
  18   { name => "DBD::Pg",                             url => "http://search.cpan.org/~dbdpg/" },
 
  19   { name => "Email::Address",                      url => "http://search.cpan.org/~rjbs/" },
 
  20   { name => "FCGI",                                url => "http://search.cpan.org/~mstrout/" },
 
  21   { name => "IO::Wrap",                            url => "http://search.cpan.org/~dskoll/" },
 
  22   { name => "List::MoreUtils",                     url => "http://search.cpan.org/~vparseval/" },
 
  23   { name => "PDF::API2",                           url => "http://search.cpan.org/~areibens/" },
 
  24   { name => "Template",        version => '2.18',  url => "http://search.cpan.org/~abw/" },
 
  25   { name => "Text::CSV_XS",                        url => "http://search.cpan.org/~hmbrand/" },
 
  26   { name => "Text::Iconv",                         url => "http://search.cpan.org/~mpiotr/" },
 
  27   { name => "URI",                                 url => "http://search.cpan.org/~gaas/" },
 
  28   { name => "XML::Writer",                         url => "http://search.cpan.org/~josephw/" },
 
  29   { name => "YAML",                                url => "http://search.cpan.org/~ingy/" },
 
  32 @optional_modules = ();
 
  34 $_->{fullname} = join ' ', grep $_, @$_{qw(name version)}
 
  35   for @required_modules, @optional_modules;
 
  38 sub module_available {
 
  40   my $version = $_[1] || '' ;
 
  42   return eval "use $module $version; 1";
 
  45 my %conditional_dependencies;
 
  47 sub check_for_conditional_dependencies {
 
  48   return if $conditional_dependencies{net_ldap}++;
 
  51   eval do { local (@ARGV, $/) = 'config/authentication.pl'; <> } or return;
 
  53   push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' }
 
  54     if $self->{module} && ($self->{module} eq 'LDAP');
 
  57 sub test_all_modules {
 
  58   return grep { !module_available($_->{name}) } @required_modules;