Skip Menu |

This queue is for tickets about the String-Escape CPAN distribution.

Report information
The Basics
Id: 77202
Status: open
Priority: 0/
Queue: String-Escape

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2010.002
Fixed in: (no value)



Subject: incorrect characters escaped in sub backslash
I think the escaping in sub backslash isn't quite right... eg -------------------- use String::Escape qw(backslash); my $x = q{#$:;<=>?}; print backslash($x)."\n"; -------------------- outputs: \x23$\x3a\x3b\x3c\x3d\x3e\x3f whereas presumably it should output: #\$:;<=>? A possible patch is just: -------------------- --- Escape.pm.orig 2012-05-14 19:28:55.739739044 +0100 +++ Escape.pm 2012-05-14 19:45:25.940227607 +0100 @@ -198,7 +198,7 @@ sub backslash ($) { local $_ = ( defined $_[0] ? $_[0] : '' ); # Preserve only printable ASCII characters other than \, ", $, and @ - s/([^\x20\x21\x24\x25-\x39\x41-\x5b\x5d-\x7e])/\\$Backslashed{$1}/gs; + s/([^\x20\x21\x23\x25-\x3f\x41-\x5b\x5d-\x7e])/\\$Backslashed{$1}/gs; return $_; } -------------------- (Btw the perldoc documentation doesn't mention that double quotes should be escaped by sub backslash, even though the comments do -- I assume the comments describe the intended behaviour.) Thanks, David
Yeah, I'm finding this out as well. The docs say: When escaping, alphanumeric characters and most punctuation is passed through unchanged; only the return, newline, tab, backslash, dollar, at sign and unprintable control and high-bit characters are escaped. But, the code says: # Preserve only printable ASCII characters other than \, ", $, and @ s/([^\x20\x21\x24\x25-\x39\x41-\x5b\x5d-\x7e])/\\$Backslashed{$1}/gs; Clearly, there's a disconnect somewhere. Looks like I'm going to have to fallback to 'printable'.