CLI-Helpers
view release on metacpan or search on metacpan
lib/CLI/Helpers.pm view on Meta::CPAN
my ($prompt,$args) = @_;
state $interactive = is_interactive();
state $term;
my $text = '';
if( $interactive ) {
# Initialize Term
$term ||= Term::ReadLine->new($0);
$args ||= {};
print "\e[s" if $args->{clear_line}; # Save cursor position
if( $args->{noecho} ) {
# Disable all the Term ReadLine magic
local $|=1;
print $prompt;
ReadMode('noecho');
$text = ReadLine();
ReadMode('restore');
print "\n";
chomp($text);
}
( run in 0.806 second using v1.01-cache-2.11-cpan-beeb90c9504 )