NAME
CTK::CLI - Command line interface
VERSION
Version 1.73
SYNOPSIS
use CTK::CLI qw/cli_prompt cli_select/;
my $v = cli_prompt('Your name:', 'anonymous');
debug( "Your name: $v" );
my $v = cli_select('Your select:',[qw/foo bar baz/],'bar');
debug( "Your select: $v" );
or in CTK context (as plugin):
my $v = $ctk->cli_prompt('Your name:', 'anonymous');
debug( "Your name: $v" );
my $v = $ctk->cli_select('Your select:',[qw/foo bar baz/],'bar');
debug( "Your select: $v" );
DESCRIPTION
Command line interface. Prompt and select methods
cli_prompt
my $v = cli_prompt('Your name:', 'anonymous');
debug( "Your name: $v" );
Show prompt string for typing data
cli_select
my $v = cli_select('Your select:',[qw/foo bar baz/],'bar');
debug( "Your select: $v" );
Show prompt string for select item
HISTORY
See Changes
file
DEPENDENCIES
TO DO
* Use Term::ReadLine module. Sample:
BEGIN { $ENV{TERM} = "dumb" if $^O eq "MSWin32" }
use Term::ReadLine ();
use Text::ParseWords qw(shellwords);
my $term = Term::ReadLine->new('T01');
my $prompt = "T> ";
my $OUT = $term->OUT || \*STDOUT;
while ( defined ($_ = $term->readline($prompt)) ) {
last if /^(quit|exit)$/;
my @w = shellwords($_);
if (@w) {
print join(" ",@w),"\n";
$term->addhistory($_);
}
}
print "\n";
BUGS
* none noted
SEE ALSO
AUTHOR
Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2022 D&D Corporation. All Rights Reserved
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE
file and https://dev.perl.org/licenses