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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 18 Apr 2005 22:28:20 -0000


albertel		Mon Apr 18 18:28:20 2005 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - this whole c?<interface> thing has always annoyed me from a code duplication point of view anyway
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.626 loncom/lonnet/perl/lonnet.pm:1.627
--- loncom/lonnet/perl/lonnet.pm:1.626	Mon Apr 18 17:19:53 2005
+++ loncom/lonnet/perl/lonnet.pm	Mon Apr 18 18:28:19 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.626 2005/04/18 21:19:53 albertel Exp $
+# $Id: lonnet.pm,v 1.627 2005/04/18 22:28:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2561,10 +2561,16 @@
     return \%returnhash;
 }
 
+# ------------------------------------------------------ critical inc interface
+
+sub cinc {
+    return &inc(@_,'critical');
+}
+
 # --------------------------------------------------------------- inc interface
 
 sub inc {
-    my ($namespace,$store,$udomain,$uname) = @_;
+    my ($namespace,$store,$udomain,$uname,$critical) = @_;
     if (!$udomain) { $udomain=$env{'user.domain'}; }
     if (!$uname) { $uname=$env{'user.name'}; }
     my $uhome=&homeserver($uname,$udomain);
@@ -2582,7 +2588,11 @@
         }
     }
     $items=~s/\&$//;
-    return &reply("inc:$udomain:$uname:$namespace:$items",$uhome);
+    if ($critical) {
+	return &critical("inc:$udomain:$uname:$namespace:$items",$uhome);
+    } else {
+	return &reply("inc:$udomain:$uname:$namespace:$items",$uhome);
+    }
 }
 
 # --------------------------------------------------------------- put interface
@@ -2639,21 +2649,6 @@
    return &critical("put:$udomain:$uname:$namespace:$items",$uhome);
 }
 
-# ------------------------------------------------------ critical inc interface
-                                                                                
-sub cinc {
-   my ($namespace,$storehash,$udomain,$uname)=@_;
-   if (!$udomain) { $udomain=$env{'user.domain'}; }
-   if (!$uname) { $uname=$env{'user.name'}; }
-   my $uhome=&homeserver($uname,$udomain);
-   my $items='';
-   foreach (keys %$storehash) {
-       $items.=escape($_).'='.&freeze_escape($$storehash{$_}).'&';
-   }
-   $items=~s/\&$//;
-   return &critical("inc:$udomain:$uname:$namespace:$items",$uhome);
-}
-
 # -------------------------------------------------------------- eget interface
 
 sub eget {