Subject: | Unwarranted Presumption About $\ |
Date: | Fri, 31 Mar 2006 14:12:41 +0100 |
To: | bug-io-prompt [...] rt.cpan.org |
From: | Smylers <Smylers [...] stripey.com> |
Hi there. Thanks for IO::Prompt -- it looks like a really useful
module.
I've spotted a bug which while small did trip me up the very first time
I tried out this module after installing it:
% perl -MIO::Prompt -wle '$t = prompt "What? "; print "[$t]"'
The text entered by the user is rather confusingly displayed only one
character per line, so it goes down the screen rather than across.
The culprit is the -l option, which is setting $\ to "\n" -- which is
exactly what I wanted in the print statement in the line above, but
which is also affecting print inside the prompt function.
The fix is simple; just add this line:
local $\ = '';
I put it just before the print statement on line 446 (in version
0.99.4):
print {$OUT}(defined $echo ? $echo : $next);
But it may be that there are other print statements in IO::Prompt
affected by this, and $\ should actually be set in a wider scope.
Best wishes, and thank you again for the module.
Smylers