[LON-CAPA-cvs] cvs: loncom /cgi metadata_keywords.pl

harris41 lon-capa-cvs@mail.lon-capa.org
Sat, 11 May 2002 21:31:00 -0000


harris41		Sat May 11 17:31:00 2002 EDT

  Modified files:              
    /loncom/cgi	metadata_keywords.pl 
  Log:
  Using LONCAPA::Configuration::read_conf
  BUG 129
  
  
Index: loncom/cgi/metadata_keywords.pl
diff -u loncom/cgi/metadata_keywords.pl:1.2 loncom/cgi/metadata_keywords.pl:1.3
--- loncom/cgi/metadata_keywords.pl:1.2	Tue Sep 25 13:35:03 2001
+++ loncom/cgi/metadata_keywords.pl	Sat May 11 17:31:00 2002
@@ -7,6 +7,9 @@
 # YEAR=2001
 # 9/25 Scott Harrison
 #
+# YEAR=2002
+# 5/11 Scott Harrison
+#
 
 ###############################################################################
 ##                                                                           ##
@@ -26,7 +29,7 @@
 # 1=horrible 2=poor 3=fair 4=good 5=excellent
 # Organization 5
 # Functionality 4
-# Has it been tested? 3
+# Has it been tested? 4
 #
 
 # ------------------------------------------ Purpose and description of program
@@ -42,6 +45,10 @@
 # should reflect this information) instead.  This is a speedier approach.
 
 # ------------------------------------------------- Modules used by this script
+
+use lib '/home/httpd/lib/perl/';
+use LONCAPA::Configuration;
+
 use strict;
 use DBI;
 
@@ -51,17 +58,10 @@
 
 # --- Make sure that database can be accessed and that this is a library server
 # library server test
-my %perlvar;
-open (CONFIG,"/etc/httpd/conf/access.conf") || 
-    (print "Can't read access.conf\n" && exit);
-while (my $configline=<CONFIG>) {
-    if ($configline =~ /PerlSetVar/) {
-	my ($dummy,$varname,$varvalue)=split(/\s+/,$configline);
-        chomp($varvalue);
-        $perlvar{$varname}=$varvalue;
-    }
-}
-close(CONFIG);
+my $perlvarref=LONCAPA::Configuration::read_conf('access.conf','loncapa.conf');
+my %perlvar=%{$perlvarref};
+undef($perlvarref);
+
 unless ($perlvar{'lonRole'} eq 'library') {
     print "This can only be run on a library server!\n";
     exit;