I am using IO::Prompt to prompt the user for input (go figure!). I am also using the 'require' option, which continually prints the prompt until the user enters a required form of input.
The problem crops up when I run the script from an env PATH in any given directory. Instead of '/r'ing and reprinting require's string argument over the previous prompt, it outputs newlines. If I run the script using ./script.pl when in /usr/local/bin/, it runs fine and I get the expected behavior.
How can I eliminate the difference between running a script from a PATH or running it inside its directory?
Update with some code...
#!/usr/bin/perl
use IO::Prompt;
prompt "next: ", -integer, -require => {
'next (must be > 0):' => sub { $_ > 0 }
};
print "[$_]\n";
This is actually from the examples included in the module. Typing ABC and pushing enter should simply overwrite the previous prompt with a new blank one. In my case, it's creating newlines.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.