[LON-CAPA-cvs] cvs: loncom /debugging_tools seed_accesscount.pl
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 14 Nov 2003 20:41:49 -0000
matthew Fri Nov 14 15:41:49 2003 EDT
Modified files:
/loncom/debugging_tools seed_accesscount.pl
Log:
Store the filenames escaped.
Index: loncom/debugging_tools/seed_accesscount.pl
diff -u loncom/debugging_tools/seed_accesscount.pl:1.1 loncom/debugging_tools/seed_accesscount.pl:1.2
--- loncom/debugging_tools/seed_accesscount.pl:1.1 Fri Nov 14 14:52:10 2003
+++ loncom/debugging_tools/seed_accesscount.pl Fri Nov 14 15:41:48 2003
@@ -2,7 +2,7 @@
#
# The LearningOnline Network
#
-# $Id: seed_accesscount.pl,v 1.1 2003/11/14 19:52:10 matthew Exp $
+# $Id: seed_accesscount.pl,v 1.2 2003/11/14 20:41:48 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -78,6 +78,7 @@
my $src;
next if (! ((undef,$src) = ($key =~ /^(.*)___(.*)___count/)));
my $value = &unescape($value);
+ $src = &escape($src);
if (exists($accessDB{$src})) {
$accessDB{$src}+=$value;
} else {
@@ -101,6 +102,12 @@
exit;
######################################
+sub escape {
+ my $str=shift;
+ $str =~ s/(\W)/"%".unpack('H2',$1)/eg;
+ return $str;
+}
+
sub unescape {
my $str=shift;
$str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;