Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: BENBOOTH [...] cpan.org
Cc:
AdminCc:

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



Subject: Use of uninitialized value warnings when unbackslashing certain escape sequences
Here is an example: $ perl -MString::Escape -e 'print String::Escape::unbackslash("test\n\\a\\b\\f\\n\\r\\t\\v\ntest\n")' Use of uninitialized value in concatenation (.) or string at /usr/local/perl5/lib/perl5/String/Escape.pm line 208. Use of uninitialized value in concatenation (.) or string at /usr/local/perl5/lib/perl5/String/Escape.pm line 208. Use of uninitialized value in concatenation (.) or string at /usr/local/perl5/lib/perl5/String/Escape.pm line 208. Use of uninitialized value in concatenation (.) or string at /usr/local/perl5/lib/perl5/String/Escape.pm line 208. test \a seems to be one that causes a warning, but \n doesn't.
Subject: [rt.cpan.org #84859]
Date: Mon, 11 Dec 2017 14:51:43 -0500
To: bug-string-escape [...] rt.cpan.org
From: Berk Akinci <berka [...] alum.wpi.edu>
On the issue: Use of uninitialized value warnings when unbackslashing certain escape sequences. This issue is worse than just a warning message. The escape sequences not unbackslashed are actually dropped altogether. I came across this problem with escaped backspace and form feeds: \b \f. It appears same would be valid for \v and \a in the example as well. My proposed fix is to add these escapes to the end of the argument to _define_backslash_escapes. That way, existing backslash behavior will remain unchanged, (lower "precedence") but the unbackslash function will find a match.
Subject: [rt.cpan.org #84859]
Date: Wed, 13 Dec 2017 11:17:37 -0500
To: bug-string-escape [...] rt.cpan.org
From: Berk Akinci <berka [...] alum.wpi.edu>
Here is the patch I've been using a few days: --- /usr/lib/perl5/site_perl/5.22/String/Escape.pm 2010-02-01 15:09:52.000000000 -0500 +++ String/Escape.pm 2017-12-12 09:27:30.875032900 -0500 @@ -11,7 +11,7 @@ use Carp; use vars qw( $VERSION ); -$VERSION = 2010.002; +$VERSION = "2010.002.Berk"; ######################################################################## @@ -187,6 +187,7 @@ ( 'r' => "\r", 'n' => "\n", 't' => "\t" ), ( map { 'x' . unpack('H2', chr($_)) => chr($_) } (0..255) ), ( map { sprintf('%03o', $_) => chr($_) } (0..255) ), + ( 'a' => "\x07", 'b' => "\x08", 'f' => "\x0c", 'v' => "\x0b" ), ); sub _define_backslash_escapes {