[LON-CAPA-cvs] cvs: loncom(version_2_8_X) /lonnet/perl lonnet.pm
raeburn
raeburn@source.lon-capa.org
Fri, 20 Mar 2009 21:18:26 -0000
raeburn Fri Mar 20 21:18:26 2009 EDT
Modified files: (Branch: version_2_8_X)
/loncom/lonnet/perl lonnet.pm
Log:
- Backport 1.987.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.976.2.6 loncom/lonnet/perl/lonnet.pm:1.976.2.7
--- loncom/lonnet/perl/lonnet.pm:1.976.2.6 Mon Jan 5 16:29:24 2009
+++ loncom/lonnet/perl/lonnet.pm Fri Mar 20 21:18:26 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.976.2.6 2009/01/05 16:29:24 raeburn Exp $
+# $Id: lonnet.pm,v 1.976.2.7 2009/03/20 21:18:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -522,7 +522,7 @@
# ----------------------------------------------------- Delete from Environment
sub delenv {
- my $delthis=shift;
+ my ($delthis,$regexp) = @_;
if (($delthis=~/user\.role/) || ($delthis=~/user\.priv/)) {
&logthis("<font color=\"blue\">WARNING: ".
"Attempt to delete from environment ".$delthis);
@@ -535,10 +535,17 @@
tie(my %disk_env,'GDBM_File',$env{'user.environment'},
(&GDBM_WRITER()|&GDBM_NOLOCK()),0640)) {
foreach my $key (keys(%disk_env)) {
- if ($key=~/^\Q$delthis\E/) {
- delete($env{$key});
- delete($disk_env{$key});
- }
+ if ($regexp) {
+ if ($key=~/^$delthis/) {
+ delete($env{$key});
+ delete($disk_env{$key});
+ }
+ } else {
+ if ($key=~/^\Q$delthis\E/) {
+ delete($env{$key});
+ delete($disk_env{$key});
+ }
+ }
}
untie(%disk_env);
}
@@ -9228,9 +9235,11 @@
=item *
X<delenv()>
-B<delenv($regexp)>: removes all items from the session
-environment file that matches the regular expression in $regexp. The
-values are also delted from the current processes %env.
+B<delenv($delthis,$regexp)>: removes all items from the session
+environment file that begin with $delthis. If the
+optional second arg - $regexp - is true, $delthis is treated as a
+regular expression, otherwise \Q$delthis\E is used.
+The values are also deleted from the current processes %env.
=item * get_env_multiple($name)