Projekt

Allgemein

Profil

Herunterladen (2,53 KB) Statistiken
| Zweig: | Markierung: | Revision:
62a8aa81 Moritz Bunkus
package SL::InstallationCheck;

8c7e4493 Moritz Bunkus
use English '-no_match_vars';
use IO::File;

42b702a6 Moritz Bunkus
use vars qw(@required_modules @optional_modules);
62a8aa81 Moritz Bunkus
3d967be3 Sven Schöling
use strict;

97063fbc Sven Schöling
BEGIN {
62a8aa81 Moritz Bunkus
@required_modules = (
3c73035d Sven Schöling
{ name => "parent", url => "http://search.cpan.org/~corion/" },
5f4e1aba Sven Schöling
{ name => "Archive::Zip", url => "http://search.cpan.org/~adamk/" },
3c73035d Sven Schöling
{ name => "Class::Accessor", url => "http://search.cpan.org/~kasei/" },
{ name => "CGI::Ajax", url => "http://search.cpan.org/~bct/" },
{ name => "DateTime", url => "http://search.cpan.org/~drolsky/" },
{ name => "DBI", url => "http://search.cpan.org/~timb/" },
{ name => "DBD::Pg", url => "http://search.cpan.org/~dbdpg/" },
{ name => "Email::Address", url => "http://search.cpan.org/~rjbs/" },
{ name => "FCGI", url => "http://search.cpan.org/~mstrout/" },
{ name => "IO::Wrap", url => "http://search.cpan.org/~dskoll/" },
{ name => "List::MoreUtils", url => "http://search.cpan.org/~vparseval/" },
{ name => "PDF::API2", url => "http://search.cpan.org/~areibens/" },
{ name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/" },
{ name => "Text::CSV_XS", url => "http://search.cpan.org/~hmbrand/" },
{ name => "Text::Iconv", url => "http://search.cpan.org/~mpiotr/" },
{ name => "URI", url => "http://search.cpan.org/~gaas/" },
{ name => "XML::Writer", url => "http://search.cpan.org/~josephw/" },
{ name => "YAML", url => "http://search.cpan.org/~ingy/" },
8eb4af24 Sven Schöling
);

@optional_modules = ();
42b702a6 Moritz Bunkus
97063fbc Sven Schöling
$_->{fullname} = join ' ', grep $_, @$_{qw(name version)}
for @required_modules, @optional_modules;
}

62a8aa81 Moritz Bunkus
sub module_available {
3c73035d Sven Schöling
my $module = $_[0];
my $version = $_[1] || '' ;
62a8aa81 Moritz Bunkus
97063fbc Sven Schöling
return eval "use $module $version; 1";
62a8aa81 Moritz Bunkus
}

8c7e4493 Moritz Bunkus
my %conditional_dependencies;

sub check_for_conditional_dependencies {
97063fbc Sven Schöling
return if $conditional_dependencies{net_ldap}++;
8c7e4493 Moritz Bunkus
97063fbc Sven Schöling
my $self = {};
eval do { local (@ARGV, $/) = 'config/authentication.pl'; <> } or return;
8c7e4493 Moritz Bunkus
97063fbc Sven Schöling
push @required_modules, { 'name' => 'Net::LDAP', 'url' => 'http://search.cpan.org/~gbarr/' }
if $self->{module} && ($self->{module} eq 'LDAP');
8c7e4493 Moritz Bunkus
}

62a8aa81 Moritz Bunkus
sub test_all_modules {
0bc62174 Moritz Bunkus
return grep { !module_available($_->{name}) } @required_modules;
62a8aa81 Moritz Bunkus
}

1;