[LON-CAPA-cvs] cvs: loncom /interface lonsource.pm portfolio.pm /publisher loncfile.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 07 Apr 2005 04:46:36 -0000


albertel		Thu Apr  7 00:46:36 2005 EDT

  Modified files:              
    /loncom/interface	portfolio.pm lonsource.pm 
    /loncom/publisher	loncfile.pm 
  Log:
  - according to the perl docs the use of $` or $' slows down all regexps in a program so elimnating them
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.80 loncom/interface/portfolio.pm:1.81
--- loncom/interface/portfolio.pm:1.80	Tue Mar 15 18:11:08 2005
+++ loncom/interface/portfolio.pm	Thu Apr  7 00:46:36 2005
@@ -283,8 +283,7 @@
 sub delete_dir_confirmed {
     my ($r)=@_;
     my $directory_name = $ENV{'form.currentpath'};
-    $directory_name =~ m/\/$/;
-    $directory_name = $`;
+    $directory_name =~ s|/$||; # remove any trailing slash
     my $result=&Apache::lonnet::removeuserfile($ENV{'user.name'},
 					       $ENV{'user.domain'},'portfolio'.
 					       $directory_name);
Index: loncom/interface/lonsource.pm
diff -u loncom/interface/lonsource.pm:1.9 loncom/interface/lonsource.pm:1.10
--- loncom/interface/lonsource.pm:1.9	Thu Feb 17 03:29:43 2005
+++ loncom/interface/lonsource.pm	Thu Apr  7 00:46:36 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Souce Code handler
 #
-# $Id: lonsource.pm,v 1.9 2005/02/17 08:29:43 albertel Exp $
+# $Id: lonsource.pm,v 1.10 2005/04/07 04:46:36 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -222,8 +222,7 @@
     } 
     if ($ENV{'form.action'} eq 'stage2') {
         my $author = &Apache::lonnet::metadata($filename,'authorspace');
-        $author =~ m|@|;
-        $author = $`; #This just tells who the author name is for later processing.
+        ($author) = split('@',$author); #strip the domain of the author name
         &stage_2($r, $ENV{'form.filename'}, $author, $listname);
     } elsif($ENV{'form.action'} eq 'copy_stage') {
         &copy_stage($r, $filename,$ENV{'form.listname'},$ENV{'form.newpath'});
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.65 loncom/publisher/loncfile.pm:1.66
--- loncom/publisher/loncfile.pm:1.65	Wed Mar  9 22:50:49 2005
+++ loncom/publisher/loncfile.pm	Thu Apr  7 00:46:36 2005
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.65 2005/03/10 03:50:49 www Exp $
+# $Id: loncfile.pm,v 1.66 2005/04/07 04:46:36 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1111,7 +1111,7 @@
 	$main=$2;		# Filename.
     }
     if($main=~m:\.(\w+)$:){ # Fixes problems with filenames with no extensions
-	$main=$`; #This is what is before the match (.) so it's just the main filename, yea it's nasty
+	$main=~s/\.\w+$//; #strip the extension
 	$suffix=$1; #This is the actually filename extension if it exists
     }
     my $dest;                   # On success this is where we'll go.
@@ -1127,8 +1127,7 @@
     
     # Select the appropriate processing sub.
     if ($ENV{'form.action'} eq 'decompress') { 
-	$main .= '.';
-	$main .= $suffix;
+	$main .= '.'.$suffix;
 	if(!&decompress2($r, $uname, $dir, $main)) {
 	    return ;
 	}