Skip Menu |

This queue is for tickets about the Text-ParseWords CPAN distribution.

Report information
The Basics
Id: 61103
Status: new
Priority: 0/
Queue: Text-ParseWords

People
Owner: Nobody in particular
Requestors: dmacks [...] netspace.org
Cc:
AdminCc:

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



Subject: Trailing backslash breaks parse_line even if $keep is true
Date: Mon, 06 Sep 2010 03:35:01 -0400
To: bug-Text-ParseWords [...] rt.cpan.org
From: "Daniel Macks" <dmacks [...] netspace.org>
I'm using Text::ParseWords 3.27 or 3.23 under perl5.10.0 or perl5.8.8 on OS X 10.6. Test program:   #!/usr/bin/perl -w use strict; use Text::ParseWords; my $a="testing testing \\"; my @a=Text::ParseWords::parse_line('\s ', 1, $a); print "string: '$a'\n"; print map "word: '$_'\n", @a;   Expected results:   string: 'testing testing \' word: 'testing' word: 'testing' word: '\'   Actual results:   string: 'testing testing \'     Note I am using $keep=1, which pod says causes the function to avoid removing non-delimiter special characters, so the trailing backslash seems like it should be treated as just an ordinary character for purposes other than actual whitespace protection. But it actually breaks the entire parser.   My use-case is as a preprocessor for a shell-like syntax, so it's possible I would have a trailing slash, and it should be handled just like any other character, the same as shell itself handles it: embedded \ protects the next character, but trailing \ on a line has a separate effect other than protecting the following \n as part of the same shell-word.   dan   -- Daniel Macks dmacks@netspace.org