version 1.4, 2002/05/16 00:00:16
|
version 1.8, 2003/02/03 18:03:52
|
Line 27
|
Line 27
|
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# YEAR=2002 |
# YEAR=2002 |
# 05/03 Scott Harrison |
|
# |
# |
### |
### |
|
|
|
# POD documentation is at the end of this short module. |
|
|
package LONCAPA::Configuration; |
package LONCAPA::Configuration; |
|
|
$VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); |
$VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/); |
Line 39 use strict;
|
Line 40 use strict;
|
|
|
my $confdir='/etc/httpd/conf/'; |
my $confdir='/etc/httpd/conf/'; |
|
|
# ------------------------------------ read_conf: read LON-CAPA server configuration, especially PerlSetVar values |
# ------------------- Subroutine read_conf: read LON-CAPA server configuration. |
sub read_conf { |
# This subroutine reads PerlSetVar values out of specified web server |
|
# configuration files. |
|
sub read_conf |
|
{ |
my (@conf_files)=@_; |
my (@conf_files)=@_; |
my %perlvar; |
my %perlvar; |
foreach my $filename (@conf_files) { |
foreach my $filename (@conf_files,'loncapa_apache.conf') |
open(CONFIG,'<'.$confdir.$filename) or die("Can't read $confdir$filename"); |
{ |
while (my $configline=<CONFIG>) { |
open(CONFIG,'<'.$confdir.$filename) or |
if ($configline =~ /^[^\#]*PerlSetVar/) { |
die("Can't read $confdir$filename"); |
|
while (my $configline=<CONFIG>) |
|
{ |
|
if ($configline =~ /^[^\#]*PerlSetVar/) |
|
{ |
my ($unused,$varname,$varvalue)=split(/\s+/,$configline); |
my ($unused,$varname,$varvalue)=split(/\s+/,$configline); |
chomp($varvalue); |
chomp($varvalue); |
$perlvar{$varname}=$varvalue; |
$perlvar{$varname}=$varvalue; |
} |
} |
} |
} |
close(CONFIG); |
close(CONFIG); |
} |
} |
my $perlvarref=\%perlvar; |
my $perlvarref=\%perlvar; |
return ($perlvarref); |
return ($perlvarref); |
} |
} |
|
|
__END__ |
__END__ |
|
|
Line 71 B<LONCAPA::Configuration> - configuratio
|
Line 79 B<LONCAPA::Configuration> - configuratio
|
use lib '/home/httpd/lib/perl/'; |
use lib '/home/httpd/lib/perl/'; |
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
|
|
LONCAPA::Configuration::read_conf('access.conf','loncapa.conf'); |
|
|
|
In the future, standard invocation of the command will be: |
|
|
|
LONCAPA::Configuration::read_conf('loncapa.conf'); |
LONCAPA::Configuration::read_conf('loncapa.conf'); |
|
|
F<access.conf> is slowly becoming deprecated. (We are currently |
|
trying to support backwards compatibility.) |
|
|
|
=head1 DESCRIPTION |
=head1 DESCRIPTION |
|
|
Many different parts of the LON-CAPA software need to read in the |
Many different parts of the LON-CAPA software need to read in the |
Line 111 given toward the B<last> file name proce
|
Line 112 given toward the B<last> file name proce
|
|
|
=head1 AUTHORS |
=head1 AUTHORS |
|
|
Scott Harrison |
|
|
|
This library is free software; you can redistribute it and/or |
This library is free software; you can redistribute it and/or |
modify it under the same terms as LON-CAPA itself. |
modify it under the same terms as LON-CAPA itself. |
|
|