w whitespace escape warning with Perl 5.44
KeePass Command Line Interface
Brought to you by:
hightowe,
perlsaiyan
With Perl 5.44, a warning gets printed when running kpcli:
$ kpcli
Possible attempt to escape whitespace in qw() list at /usr/bin/kpcli line 1641 (#1)
(W qw) qw() lists contain items separated by whitespace; contrary to
what some might expect, backslash characters cannot be used to "protect"
whitespace from being split, but are instead treated as literal data.
(You may have used different delimiters than the parentheses shown here;
braces are also frequently used.)
You probably wrote something like this:
@list = qw(
a\ string
another
);
expecting to get a two element list containing the strings 'a string'
and 'another'. Instead the list will hold three elements: 'a\'
(with a literal backslash), 'string' and 'another'.
If you really want whitespace in your strings, build your list the
old-fashioned way, with quotes and commas:
@list = ( 'a string', 'another' );
Note that this warnings is only emitted when the backslash is followed
by actual whitespace (that qw splits on).
Possible attempt to escape whitespace in qw() list at /usr/bin/kpcli line 1769 (#1)
KeePass CLI (kpcli) v4.1.3 is ready for operation.
Type 'help' for a description of available commands.
Type 'help <command>' for details on individual commands.
kpcli:/>
Thanks for the bug report.
This is due to a (really dumb, IMO) change in 5.44 that now throws this stupid warning on Perl code that is and has been valid for decades. In kpcli's case, this line is the trigger and it is found in two places in the code:
This is how it will be fixed in the next release: https://sourceforge.net/p/kpcli/code/75/tree/trunk/kpcli-DEVELOPMENT.pl?diff=6570cda74363ae34c51814f1:74&diformat=sidebyside
That is overkill since adding a "\" at the two "@busy_chars =" lines would fix it, but I am a fan of consolidating and documenting stuff like this...