[LON-CAPA-cvs] cvs: loncom /interface lonrss.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 13 Apr 2006 18:12:50 -0000


albertel		Thu Apr 13 14:12:50 2006 EDT

  Modified files:              
    /loncom/interface	lonrss.pm 
  Log:
  - death to unneccessarily global vars
  
  
Index: loncom/interface/lonrss.pm
diff -u loncom/interface/lonrss.pm:1.15 loncom/interface/lonrss.pm:1.16
--- loncom/interface/lonrss.pm:1.15	Thu Apr 13 13:57:17 2006
+++ loncom/interface/lonrss.pm	Thu Apr 13 14:12:49 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # RSS Feeder
 #
-# $Id: lonrss.pm,v 1.15 2006/04/13 17:57:17 www Exp $
+# $Id: lonrss.pm,v 1.16 2006/04/13 18:12:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,7 +36,6 @@
 use Apache::lonlocal;
 use Apache::lonhtmlcommon;
 
-my $feedcounter;
 
 sub filterfeedname {
     my $filename=shift;
@@ -106,9 +105,16 @@
     return qq|<link rel="alternate" type="application/rss+xml" title="Course Announcements" href="$url" />|;
 }
 
+{
+    my $feedcounter;
+    sub get_new_feed_id {
+	$feedcounter++;
+	return time().'00000'.$$.'00000'.$feedcounter;
+    }
+}
+
 sub addentry {
-    $feedcounter++;
-    my $id=time.'00000'.$$.'00000'.$feedcounter;
+    my $id=&get_new_feed_id();
     return &editentry($id,@_);
 }
 
@@ -213,8 +219,7 @@
 	    }
 	}
     }
-    $feedcounter++;
-    my $newid=time.'00000'.$$.'00000'.$feedcounter;
+    my $newid = &get_new_feed_id();
 # Is this user for real?
     my $homeserver=&Apache::lonnet::homeserver($uname,$udom);
     if ($html) {