[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 16 Mar 2004 21:29:31 -0000


albertel		Tue Mar 16 16:29:31 2004 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Style police.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.477 loncom/lonnet/perl/lonnet.pm:1.478
--- loncom/lonnet/perl/lonnet.pm:1.477	Tue Mar 16 15:15:08 2004
+++ loncom/lonnet/perl/lonnet.pm	Tue Mar 16 16:29:31 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.477 2004/03/16 20:15:08 raeburn Exp $
+# $Id: lonnet.pm,v 1.478 2004/03/16 21:29:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1172,7 +1172,7 @@
     $ENV{'user.environment'}=~/\/([^\/]+)\.id/;
     my $token=$1;
 #    if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/([^\/]+)(\?\.*)*$/) {
-    if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/(.+)(\?\.*)*$/) {
+    if ($uri=~m|^uploaded/([^/]+)/([^/]+)/(.+)(\?\.*)*$|) {
 	&appenv('userfile.'.$1.'/'.$2.'/'.$3 => $ENV{'request.course.id'});
         return 'http://'.$hostname{ &homeserver($2,$1)}.'/'.$uri.
                (($uri=~/\?/)?'&':'?').'token='.$token.
@@ -1182,20 +1182,24 @@
     }
 }
 
-# --------------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course
-# input: action, courseID, current domain, home server for course, intended path to file,
-# source of file.
+# --------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course
+# input: action, courseID, current domain, home server for course, intended
+#        path to file, source of file.
 # output: ok if successful, diagnostic message otherwise
 #
-# Allows directory structure to be used within lonUsers/../userfiles/ for a course.
+# Allows directory structure to be used within lonUsers/../userfiles/ for a 
+# course.
 #
-# action = propagate - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will
-# be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles in course's home server.
+# action = propagate - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file
+#          will be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles in
+#          course's home server.
 #
-# action = copy - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will be copied
-# from $source (current location) to /home/httpd/html/userfiles/$domain/1/2/3/$course/$file
-# and will then be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles/$file in
-# course's home server.
+# action = copy - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will
+#          be copied from $source (current location) to 
+#          /home/httpd/html/userfiles/$domain/1/2/3/$course/$file
+#         and will then be copied to
+#          /home/httpd/lonUsers/$domain/1/2/3/$course/userfiles/$file in
+#         course's home server.
 
 sub process_coursefile {
     my ($action,$docuname,$docudom,$docuhome,$file,$source)=@_;
@@ -1207,11 +1211,11 @@
         my $fetchresult = '';
         my $fpath = '';
         my $fname = $file;
-        ($fpath,$fname) = ($file =~ m/^(.*)\/([^\/]+)$/);
+        ($fpath,$fname) = ($file =~ m|^(.*)/([^/]+)$|);
         $fpath=$docudom.'/'.$docuname.'/'.$fpath;
         my $filepath=$perlvar{'lonDocRoot'}.'/userfiles';
         unless ($fpath eq '') {
-            my @parts=split(/\//,$fpath);
+            my @parts=split('/',$fpath);
             foreach my $part (@parts) {
                 $filepath.= '/'.$part;
                 if ((-e $filepath)!=1) {