mhonarc-users

Small buglet in mhdb.pl (and fix)

1996-01-22 06:48:55
mhonarc v1.1.0 stopped working after a message with

Subject: Use of / and \

was archived. The reason is that this is saved as wrong
perl code in .mhonarc.db:

%Subject = (
...
'821951916^\1284', 'Re: use of / and \',
...
);

The '\' in the subject is not escaped. Appended is a tiny patch
that fix it.

Achim
P.S. The patch is against the 1.1.0 mhdb.pl and also includes  the "'"
     escape patch for hash keys I send some time ago.

--- mhdb.pl.save        Wed May  3 21:31:40 1995
+++ mhdb.pl     Mon Jan 22 11:08:30 1996
@@ -105,11 +105,13 @@
 ##---------------------------------------------------------------------------
 sub print_assoc {
     local($handle, $name, *assoc) = @_;
-    local($tmp);
+    local($tmp,$key);
 
     print $handle "%$name = (\n";
     foreach (keys %assoc) {
-       ($tmp = $assoc{$_}) =~ s/'/\\'/g;
+       ($key = $_ ) =~ s/'/\\'/g;
+       ($tmp = $assoc{$_}) =~ s/\\/\\\\/g;
+       $tmp =~ s/'/\\'/g;
        print $handle qq|'$_', '$tmp',\n|;
     }
     print $handle ");\n";
<Prev in Thread] Current Thread [Next in Thread>