Subject: | manpage unclear regarding $keep |
From <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=125778>:
From the second paragraph of the description:
The $keep argument is a boolean flag. If true, then the
tokens are split on the specified delimiter, but all other
characters (quotes, backslashes, etc.) are kept in the
tokens. If $keep is false then the &*quotewords() func
tions remove all quotes and backslashes that are not them
selves backslash-escaped or inside of single quotes (i.e.,
"ewords() tries to interpret these characters just
like the Bourne shell).
If I understand correctly, the first parenthetical comment is not
implying the existence of additional metacharacters understood by
ParseWords beyond quotes and backslashes, only noting that *all*
characters (including obviously all non-metacharacters) are passed
through. If this is correct, then the 'etc.' is somewhat unfortunate
and confusing and the parenthetical comment would be more
understandable as 'including quotes and backslashes'.
The description of the case where $keep is false seems to imply that
quotes are indeed the only metacharacters ParseWords concerns itself
with, but of course Bourne shell has more of them, and the mention of
it is enough to make a person nervous.
Trivial patch attached, to be applied if you agree.
Subject: | Text-Parsewords-keep-clarification.patch |
--- ParseWords.pm.orig 2013-09-07 18:58:51.000000000 +0100
+++ ParseWords.pm 2013-09-07 18:59:10.000000000 +0100
@@ -202,8 +202,8 @@
call.
The $keep argument is a boolean flag. If true, then the tokens are
-split on the specified delimiter, but all other characters (quotes,
-backslashes, etc.) are kept in the tokens. If $keep is false then the
+split on the specified delimiter, but all other characters (including
+quote and backslashes) are kept in the tokens. If $keep is false then the
&*quotewords() functions remove all quotes and backslashes that are
not themselves backslash-escaped or inside of single quotes (i.e.,
"ewords() tries to interpret these characters just like the Bourne