Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 62a8aa81

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID 62a8aa81ec93edf284b3ffcc065120b3fe303fb5
  • Vorgänger b17ce5e1
  • Nachfolger 9324ddb2

Installations-Check-Modul. Das Script installation_check.pl nutzt es.

Unterschiede anzeigen:

SL/InstallationCheck.pm
1
package SL::InstallationCheck;
2

  
3
use vars qw(@required_modules);
4

  
5
@required_modules = (
6
  { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" },
7
  { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" },
8
  { "name" => "CGI::Ajax", "url" => "http://search.cpan.org/~bct/" },
9
  { "name" => "DBI", "url" => "http://search.cpan.org/~timb/" },
10
  { "name" => "DBD::Pg", "url" => "http://search.cpan.org/~dbdpg/" },
11
  { "name" => "HTML::Template", "url" => "http://search.cpan.org/~samtregar/" },
12
  { "name" => "Archive::Zip", "url" => "http://search.cpan.org/~adamk/" },
13
  { "name" => "Text::Iconv", "url" => "http://search.cpan.org/~mpiotr/" },
14
  { "name" => "Klaus", "url" => "http://dum.my/" },
15
  );
16

  
17
sub module_available {
18
  my ($module) = @_;
19

  
20
  if (!defined(eval("require $module;"))) {
21
    return 0;
22
  } else {
23
    return 1;
24
  }
25
}
26

  
27
sub test_all_modules {
28
  my @missing_modules;
29

  
30
  map({ push(@missing_modules, $_) unless (module_available($_)); }
31
      @required_modules);
32

  
33
  return @missing_modules;
34
}
35

  
36
1;
doc/INSTALL
30 30
* CGI::Ajax
31 31
* Class::Accessor
32 32
* Archive::Zip
33
* Text::Iconv
33 34

  
34 35
Diese Pakete k?nnen bei den unterschiedlichen Distributionen anders hei?en. 
35
(Debian: apache, postgresql, libdbi-perl, libdbd-pg-perl,  libpgperl, libhtml-template-perl, libclass-accessor-perl, libarchive-zip-perl)
36
(Debian: apache, postgresql, libdbi-perl, libdbd-pg-perl,  libpgperl, libhtml-template-perl, libclass-accessor-perl, libarchive-zip-perl, libtext-iconv-perl)
36 37
(Fedora: httpd, postgresql-server, perl-DBI, perl-DBD-Pg) 
37 38
(SuSE: apache2, postgresql-server,  perl-DBI, perl-DBD-Pg)
38 39

  
scripts/installation_check.pl
1 1
#!/usr/bin/perl -w
2 2

  
3
$| = 1;
4

  
5
my @required_modules = (
6
  { "name" => "Class::Accessor", "url" => "http://search.cpan.org/~kasei/" },
7
  { "name" => "CGI", "url" => "http://search.cpan.org/~lds/" },
8
  { "name" => "CGI::Ajax", "url" => "http://search.cpan.org/~bct/" },
9
  { "name" => "DBI", "url" => "http://search.cpan.org/~timb/" },
10
  { "name" => "DBD::Pg", "url" => "http://search.cpan.org/~dbdpg/" },
11
  { "name" => "HTML::Template", "url" => "http://search.cpan.org/~samtregar/" },
12
  { "name" => "Archive::Zip", "url" => "http://search.cpan.org/~adamk/" },
13
  { "name" => "Text::Iconv", "url" => "http://search.cpan.org/~mpiotr/" },
14
  );
3
use SL::InstallationCheck;
15 4

  
16
sub module_available {
17
  my ($module) = @_;
18

  
19
  if (!defined(eval("require $module;"))) {
20
    return 0;
21
  } else {
22
    return 1;
23
  }
24
}
5
$| = 1;
25 6

  
26
foreach my $module (@required_modules) {
7
foreach my $module (@SL::InstallationCheck::required_modules) {
27 8
  print("Looking for $module->{name}...");
28
  if (!module_available($module->{"name"})) {
9
  if (!SL::InstallationCheck::module_available($module->{"name"})) {
29 10
    print(" NOT found\n" .
30 11
          "  The module '$module->{name}' is not available on your system.\n" .
31 12
          "  Please install it with the CPAN shell, e.g.\n" .
32
          "    perl -MCPAN -e install \"install $module->{name}\"\n" .
13
          "    perl -MCPAN -e \"install $module->{name}\"\n" .
33 14
          "  or download it from this URL and install it manually:\n" .
34 15
          "    $module->{url}\n\n");
35 16
  } else {

Auch abrufbar als: Unified diff