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 => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/" },
22 { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/" },
23 { name => "Readonly", url => "http://search.cpan.org/~roode/" },
24 { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/" },
25 { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/" },
26 { name => "Rose::DB::Object", url => "http://search.cpan.org/~jsiracusa/" },
27 { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/" },
28 { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/" },
29 { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/" },
30 { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/" },
31 { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/" },
32 { name => "YAML", version => '0.62', url => "http://search.cpan.org/~ingy/" },
35 @optional_modules = ();
37 $_->{fullname} = join ' ', grep $_, @$_{qw(name version)}
38 for @required_modules, @optional_modules;
41 sub module_available {
43 my $version = $_[1] || '' ;
45 return eval "use $module $version; 1";
48 my %conditional_dependencies;
50 sub check_for_conditional_dependencies {
51 return if $conditional_dependencies{net_ldap}++;
54 eval do { local (@ARGV, $/) = 'config/authentication.pl'; <> } or return;
56 push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' }
57 if $self->{module} && ($self->{module} eq 'LDAP');
60 sub test_all_modules {
61 return grep { !module_available($_->{name}) } @required_modules;