1 package SL::InstallationCheck;
3 use English '-no_match_vars';
6 use vars qw(@required_modules @optional_modules @developer_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 => "Clone", url => "http://search.cpan.org/~rdf/", debian => 'libclone-perl' },
15 { name => "Config::Std", url => "http://search.cpan.org/~dconway/", debian => 'libconfig-std-perl' },
16 { name => "DateTime", url => "http://search.cpan.org/~drolsky/", debian => 'libdatetime-perl' },
17 { name => "DBI", version => '1.50', url => "http://search.cpan.org/~timb/", debian => 'libdbi-perl' },
18 { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/", debian => 'libdbd-pg-perl' },
19 { name => "Email::Address", url => "http://search.cpan.org/~rjbs/", debian => 'libemail-address-perl' },
20 { name => "Email::MIME", url => "http://search.cpan.org/~rjbs/", debian => 'libemail-mime-perl' },
21 { name => "FCGI", version => '0.72', url => "http://search.cpan.org/~mstrout/", debian => 'libfcgi-perl' },
22 { name => "File::Copy::Recursive", url => "http://search.cpan.org/~dmuey/", debian => 'libfile-copy-recursive-perl' },
23 { name => "JSON", url => "http://search.cpan.org/~makamaka", debian => 'libjson-perl' },
24 { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/", debian => 'liblist-moreutils-perl' },
25 { name => "Params::Validate", url => "http://search.cpan.org/~drolsky/", debian => 'libparams-validate-perl' },
26 { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/", debian => 'libpdf-api2-perl' },
27 { name => "Rose::Object", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-object-perl' },
28 { name => "Rose::DB", url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-perl' },
29 { name => "Rose::DB::Object", version => 0.788, url => "http://search.cpan.org/~jsiracusa/", debian => 'librose-db-object-perl' },
30 { name => "String::ShellQuote", version => 1.01, url => "http://search.cpan.org/~rosch/", debian => 'libstring-shellquote-perl' },
31 { name => "Sort::Naturally", url => "http://search.cpan.org/~sburke/", debian => 'libsort-naturally-perl' },
32 # Test::Harness is core, so no Debian packages. Test::Harness 3.00 was first packaged in 5.10.1
33 { name => "Test::Harness", version => '3.00', url => "http://search.cpan.org/~petdance/", },
34 { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/", debian => 'libtemplate-perl' },
35 { name => "Text::CSV_XS", version => '0.23', url => "http://search.cpan.org/~hmbrand/", debian => 'libtext-csv-xs-perl' },
36 { name => "Text::Iconv", version => '1.2', url => "http://search.cpan.org/~mpiotr/", debian => 'libtext-iconv-perl' },
37 { name => "URI", version => '1.35', url => "http://search.cpan.org/~gaas/", debian => 'liburi-perl' },
38 { name => "XML::Writer", version => '0.602', url => "http://search.cpan.org/~josephw/", debian => 'libxml-writer-perl' },
39 { name => "YAML", version => '0.62', url => "http://search.cpan.org/~ingy/", debian => 'libyaml-perl' },
43 { name => "Digest::SHA", url => "http://search.cpan.org/~mshelor/", debian => 'libdigest-sha-perl' },
44 { name => "IO::Socket::SSL", url => "http://search.cpan.org/~sullr/", debian => 'libio-socket-ssl-perl' },
45 { name => "Net::LDAP", url => "http://search.cpan.org/~gbarr/", debian => 'libnet-ldap-perl' },
46 # Net::SMTP is core since 5.7.3
47 { name => "Net::SMTP::SSL", url => "http://search.cpan.org/~cwest/", debian => 'libnet-smtp-ssl-perl' },
48 { name => "Net::SSLGlue", url => "http://search.cpan.org/~sullr/", debian => 'libnet-sslglue-perl' },
51 @developer_modules = (
52 { name => "Devel::REPL", url => "http://search.cpan.org/~doy/", debian => 'libdevel-repl-perl' },
53 { name => "Moose::Role", url => "http://search.cpan.org/~doy/", debian => 'libmoose-role-perl' },
54 { name => "Perl::Tags", url => "http://search.cpan.org/~osfameron/", debian => 'libperl-tags-perl' },
55 { name => "Test::Deep", url => "http://search.cpan.org/~rjbs/", debian => 'libtest-deep-perl' },
56 { name => "Test::Exception", url => "http://search.cpan.org/~adie/", debian => 'libtest-exception-perl' },
57 { name => "Test::Output", url => "http://search.cpan.org/~bdfoy/", debian => 'libtest-output-perl' },
58 { name => "GD", version => '2.00', url => "http://search.cpan.org/~lds/", debian => 'libgd-perl' },
61 $_->{fullname} = join ' ', grep $_, @$_{qw(name version)}
62 for @required_modules, @optional_modules, @developer_modules;
66 sub module_available {
68 my $version = $_[1] || '' ;
70 my $got = eval "use $module $version (); 1";
73 return ($got, $module->VERSION);
80 my $exit = system("which kpsewhich > /dev/null");
82 return $exit > 0 ? 0 : 1;
87 opendir my $dh, $path || die "can't open $path";
88 my @templates = sort grep { !/^\.\.?$/ } readdir $dh;
94 sub classes_from_latex {
95 my ($path, $class) = @_;
96 eval { use String::ShellQuote; 1 } or warn "can't load String::ShellQuote" && return;
97 $path = shell_quote $path;
98 $class = shell_quote $class;
100 open my $pipe, q#egrep -rs '^[\ \t]*# . "$class' $path". q# | sed 's/ //g' | awk -F '{' '{print $2}' | awk -F '}' '{print $1}' |#;
104 # can't use uniq here
105 my %class_hash = map { $_ => 1 } map { s/\n//; $_ } split ',', join ',', @cls;
106 return sort keys %class_hash;
109 my %conditional_dependencies;
111 sub check_for_conditional_dependencies {
112 return if $conditional_dependencies{net_ldap}++;
114 push @required_modules, grep { $_->{name} eq 'Net::LDAP' } @optional_modules
115 if $::lx_office_conf{authentication} && ($::lx_office_conf{authentication}->{module} eq 'LDAP');
118 sub test_all_modules {
119 return grep { !module_available($_->{name}) } @required_modules;