CTK::CLI - Command line interface
Version 1.73
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" );
Command line interface. Prompt and select methods
my $v = cli_prompt('Your name:', 'anonymous'); debug( "Your name: $v" );
Show prompt string for typing data
my $v = cli_select('Your select:',[qw/foo bar baz/],'bar'); debug( "Your select: $v" );
Show prompt string for select item
See Changes file
Changes
ExtUtils::MakeMaker
* 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";
* none noted
Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>
Copyright (C) 1998-2022 D&D Corporation. All Rights Reserved
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
LICENSE
To install CTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CTK
CPAN shell
perl -MCPAN -e shell install CTK
For more information on module installation, please visit the detailed CPAN module installation guide.