[LON-CAPA-cvs] cvs: doc /loncapafiles updatequery.piml

raeburn raeburn at source.lon-capa.org
Fri Jul 29 12:44:36 EDT 2016


raeburn		Fri Jul 29 16:44:36 2016 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - Add strict pragma
  - Fix some typos 
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.81 doc/loncapafiles/updatequery.piml:1.82
--- doc/loncapafiles/updatequery.piml:1.81	Sat Apr  9 19:04:39 2016
+++ doc/loncapafiles/updatequery.piml	Fri Jul 29 16:44:36 2016
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.81 2016/04/09 19:04:39 raeburn Exp $ -->
+<!-- $Id: updatequery.piml,v 1.82 2016/07/29 16:44:36 raeburn Exp $ -->
 
 <!--
 
@@ -33,6 +33,7 @@
 <target dist='default'>/</target>
 <perlscript mode='fg'>
 $|=1;
+  use strict;
   print(<<END);
 
 
@@ -53,6 +54,7 @@
 <file>
 <target dist='default'>loncom/hosts.tab</target>
 <perlscript mode='fg'>
+my $lonCluster;
 unless (-l "<TARGET />") {
   print(<<END);
 
@@ -81,7 +83,7 @@
 
 # get input
 # if valid then process, otherwise loop
-$flag=0;
+my $flag=0;
 while (!$flag) {
   print "ENTER 1, 2, 3, or 4:\n";
   my $choice=<>;
@@ -138,8 +140,8 @@
 The following 7 values are needed to configure LON-CAPA:
 * Machine Role
 * LON-CAPA Domain Name
-* LON-CAPA Machine ID Name, and
-* Server Administration E-mail Address.
+* LON-CAPA Machine ID Name
+* Server Administration E-mail Address
 * LON-CAPA Domain's Primary Library Server Machine ID
 * Web Server Protocol
 * Internet Domain Name of Your Institution
@@ -220,7 +222,7 @@
  have to actually work together with your colleagues. You can still run
  multiple library servers within the same domain.
  If this domain is eventually going to be part of the main production
- cluster, you MUST contact the LON-CAPA group at MSU (loncapa at loncapa.org)
+ cluster, you MUST contact the LON-CAPA group at MSU (loncapa\@loncapa.org)
  to have a domain name assigned, and then use it exactly as given. This is
  also true for test installs that might eventually turn into production setups.
  Stop now if you didn't do so.]
@@ -579,7 +581,7 @@
     unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
        my $lonReceipt='';
        srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
-       my @alnum=(0..9,a..z);
+       my @alnum=(0..9,"a".."z");
        foreach my $i (1..20) {
 	 $lonReceipt.=$alnum[int(rand(36))];
        }
@@ -656,7 +658,7 @@
     unless ($perlvar{'lonReceipt'} and $perlvar{'lonReceipt'}!~/\{\[\[\[\[/) {
        my $lonReceipt='';
        srand(time ^ $$ ^ unpack "%L*", `ps axww | gzip`);
-       my @alnum=(0..9,a..z);
+       my @alnum=(0..9,"a".."z");
        foreach my $i (1..20) {
 	 $lonReceipt.=$alnum[int(rand(36))];
        }
@@ -736,7 +738,7 @@
         }
     }
 
-    while(!$primaryLibServ && (@hosts_file || @domain_files)) {
+    while(!$primaryLibServer && (@hosts_files || @domain_files)) {
 	my $file = shift(@domain_files);
         open(IN,'<'.$file);
         while(my $line = <IN>) {
@@ -765,7 +767,7 @@
 # implement editing logic below, interactively
 # update loncapa.conf until 14 is entered
 
-$flag=0;
+my $flag=0;
 
 while (!$flag) {
   print(<<END);
@@ -790,8 +792,8 @@
 
 my @error;
 foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {
-   if (length($v)>35) { $error.="\nName $v too long"; }		
-   if (length($v)<2) { $error.="\nName $v too short"; }
+   if (length($v)>35) { push(@error,"Name $v too long"); }		
+   if (length($v)<2) { push(@error,"Name $v too short"); }
    if ($v=~/capa/i) {
 	if ($v!~/^oucapa\d+$/ && 
 	    ($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
@@ -1008,7 +1010,7 @@
     }
     ($securestatus,$securenum)=&securesetting(%perlvar);
   }
-  elsif (($choice==14) && (!$error)) {
+  elsif (($choice==14) && (!@error)) {
     $flag=1;
   }
   else {
@@ -1035,18 +1037,18 @@
 <perlscript mode='fg'>
 unless (-l "<TARGET />") {
   my $hostname=`hostname -f`;chomp($hostname);
-  $date=`date -I`; chomp($date);
-  $lonHostID=$perlvar{'lonHostID'};
+  my $date=`date -I`; chomp($date);
+  my $lonHostID=$perlvar{'lonHostID'};
   $lonHostID=~s/[^\w\-.]//g;
-  $lineexistflag=0;
-  $hostidexistflag=0;
-  $line2insert=<<END;
+  my $lineexistflag=0;
+  my $hostidexistflag=0;
+  my $line2insert=<<END;
 $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname:$protocol:$intdom
 END
   if (!$domainTabExtras) {
 	$domainTabExtras=':::::';
   }
-  $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n";
+  my $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n";
   if ($lonCluster eq 'standalone') {
     open(OUT,'>../'.$lonCluster.'_hosts.tab') or
       die('file generation error');
@@ -1125,6 +1127,7 @@
     }
   }
   $lineexistflag=0;
+  my $domainexistflag=0;
   if ($flag==1) {
     `rm -f ../domain.tab`;
     `rm -f ../dns_domain.tab`;
@@ -1154,7 +1157,7 @@
        close(OUT);
       `ln -s new_${lonCluster}_domain.tab ../domain.tab`;
       # email appropriate message
-      `echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaninsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
+      `echo "REPLACEdom:$lonCluster:$lonHostID:$date:$domaininsert" | mail -s "REPLACEdom:$lonCluster:$lonHostID:$date" installrecord\@mail.lon-capa.org`;
     }
     elsif ($domainexistflag and $lineexistflag) {
       `grep -v "$perlvar{'lonDefDomain'}:" ../${lonCluster}_domain.tab > ../new_${lonCluster}_domain.tab`;




More information about the LON-CAPA-cvs mailing list