#!/usr/bin/perl # We find all Mod_Survey-related modules in the installation # directory. use lib $ENV{"_SURVEY_HOME"}; # If mod_survey is started under Apache 2.0.x, these lines should # enable backwards-compatibility with mod_perl 1.x syntax. eval "use Apache2 ();"; eval "use Apache::compat;"; sub showDebug { my($line); foreach $line (@INC) { print $line . "\n"; } } use Survey::Language; my($sld) = $ENV{"_SURVEY_LANG_DIRECTORY"}; my($sl) = $ENV{"_SURVEY_LANG"}; my($slf) = "$sld/$sl.sl"; my($error) = Survey::Language->setupLanguage($slf); if($error) { print "\n\nERROR: $error\n\n\n"; die; } # "use" the parameter module and die if this caused an error sub loadModule { my($module) = shift; eval "use $module;"; if($@) { die "\n\nERROR WHILE STARTING MOD_SURVEY:\n--------------------------------\n\n" . $@ . "\n\n"; } 1; } # Iterate through module array and call loadModule for each sub loadModules { my(@modules) = @_; my($module); foreach $module (@modules) { &loadModule($module); } 1; } # These modules has to be loaded always @requiredmodules = ( "CGI", "CGI::Cookie", "Survey::Admin", "Survey::Argument", "Survey::Data", "Survey::Debug", "Survey::Display", "Survey::Document", "Survey::Handler", "Survey::Session", "Survey::SessionArg", "Survey::Slask", "Survey::Submit", "Survey::System" ); @exportmodules = ( "Survey::Export::Export", "Survey::Export::StatUtils", "Survey::Export::EventBasedExport" ); # Patch from MB, compatibility with old survey.conf files if($ENV{"_SURVEY_ALLOWED_EXPORTS"}) { my($exp) = $ENV{"_SURVEY_ALLOWED_EXPORTS"}; my(@lst) = split(/,/,$exp); foreach $cell (@lst) { $inc = $ENV{"_SURVEY_EXPORT_$cell"}; push(@exportmodules,$inc); } } if($ENV{"_SURVEY_OPTIONAL_EXPORTS"}) { my($exp) = $ENV{"_SURVEY_OPTIONAL_EXPORTS"}; my(@lst) = split(/,/,$exp); foreach $cell (@lst) { $inc = $ENV{"_SURVEY_EXPORT_$cell"}; push(@exportmodules,$inc); } } &loadModules(@requiredmodules); &loadModules(@componentmodules); &loadModules(@exportmodules); if($ENV{"_SURVEY_USEDBI"}) { eval "use Survey::Component::Import"; if($@) { die "\n\nERROR WHILE STARTING MOD_SURVEY:\n--------------------------------\n\n" . $@ . "\n\n"; } &loadModule("DBI"); } 1;