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/", debian => 'libparent-perl' },
13 { name => "Archive::Zip", version => '1.16', url => "http://search.cpan.org/~adamk/", debian => 'libarchive-zip-perl' },
14 { name => "Class::Accessor", version => '0.30', url => "http://search.cpan.org/~kasei/", debian => 'libclass-accessor-perl' },
15 { name => "Config::Std", url => "http://search.cpan.org/~dconway/", debian => 'libconfig-std-perl' },
16 { name => "CGI::Ajax", version => '0.697', url => "http://search.cpan.org/~bct/" }, # no debian package, ours contains bugfixes
17 { name => "DateTime", url => "http://search.cpan.org/~drolsky/", debian => 'libdatetime-perl' },
18 { name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/", debian => 'libdbi-perl' },
19 { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/", debian => 'libdbd-pg' },
20 { name => "Email::Address", url => "http://search.cpan.org/~rjbs/", debian => 'libemail-address-perl' },
21 { name => "FCGI", url => "http://search.cpan.org/~mstrout/", debian => 'libfcgi-perl' },
22 { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/", debian => 'liblist-moreutils-perl' },
23 { name => "Params::Validate", url => "http://search.cpan.org/~drolsky/", debian => 'libparams-validate-perl' },
24 { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/", debian => 'libpdf-api2-perl' },
25 { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-object-perl' },
26 { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-perl' },
27 { name => "Rose::DB::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-object-perl' },
28 { name => "Sort::Naturally", url => "http://search.cpan.org/~sburke/", debian => 'libsort-naturally-perl' },
29 { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/", debian => 'libtemplate-perl' },
30 { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/", debian => 'libtext-csv-xs-perl' },
31 { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/", debian => 'libtext-iconv-perl' },
32 { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/", debian => 'liburi-perl' },
33 { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/", debian => 'libxml-writer-perl' },
34 { name => "YAML", version => '0.62', url => "http://search.cpan.org/~ingy/", debian => 'libyaml-perl' },
37 @optional_modules = ();
39 $_->{fullname} = join ' ', grep $_, @$_{qw(name version)}
40 for @required_modules, @optional_modules;
43 sub module_available {
45 my $version = $_[1] || '' ;
47 return eval "use $module $version; 1";
50 my %conditional_dependencies;
52 sub check_for_conditional_dependencies {
53 return if $conditional_dependencies{net_ldap}++;
56 eval do { local (@ARGV, $/) = 'config/authentication.pl'; <> } or return;
58 push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' }
59 if $self->{module} && ($self->{module} eq 'LDAP');
62 sub test_all_modules {
63 return grep { !module_available($_->{name}) } @required_modules;