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", version => '1.16', url => "http://search.cpan.org/~adamk/" },
14 { name => "Class::Accessor", version => '0.30', url => "http://search.cpan.org/~kasei/" },
15 { name => "CGI::Ajax", version => '0.697', url => "http://search.cpan.org/~bct/" },
16 { name => "DateTime", url => "http://search.cpan.org/~drolsky/" },
17 { name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/" },
18 { name => "DBD::Pg", version => '1.49', 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", version => '2.110', url => "http://search.cpan.org/~dskoll/" },
22 { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/" },
23 { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/" },
24 { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/" },
25 { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/" },
26 { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/" },
27 { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/" },
28 { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/" },
29 { name => "YAML", version => '0.62', 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;