[interchange] Fix bug where hash keys are not properly escaped in uneval.

Peter Ajamian interchange-cvs at icdevgroup.org
Thu Apr 26 05:49:43 UTC 2012


commit 67cc2df5449f61b0b7ae20910ece09c8101e8e87
Author: Peter Ajamian <peter at pajamian.dhs.org>
Date:   Thu Apr 26 17:47:22 2012 +1200

    Fix bug where hash keys are not properly escaped in uneval.
    
    Fix bug where hash keys don't get properly escaped in uneval resulting in code
    that fails when an eval or reval attempt is made.

 lib/Vend/Util.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/lib/Vend/Util.pm b/lib/Vend/Util.pm
index ce76ad9..353dc80 100644
--- a/lib/Vend/Util.pm
+++ b/lib/Vend/Util.pm
@@ -655,6 +655,7 @@ sub uneval_it {
     } elsif ($r eq 'HASH') {
 	$s = "{";
 	while (($key, $value) = each %$o) {
+	    $key =~ s/(['\\])/\\$1/g;
 	    $s .= "'$key' => " . uneval_it($value) . ",";
 	}
 	$s .= "}";



More information about the interchange-cvs mailing list