line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CTK::Plugin::CLI; |
2
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
3
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=encoding utf-8 |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
CTK::Plugin::CLI - CLI plugin |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 1.00 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use CTK; |
18
|
|
|
|
|
|
|
my $ctk = new CTK( |
19
|
|
|
|
|
|
|
plugins => "cli", |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
print $ctk->cli_prompt; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Command-Line Interface plugin |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 8 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item B |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $v = $ctk->cli_prompt('Your name:', 'anonymous'); |
34
|
|
|
|
|
|
|
debug( "Your name: $v" ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Show prompt string for typing data |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
See L |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item B |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $v = $ctk->cli_select('Your select:',[qw/foo bar baz/],'bar'); |
43
|
|
|
|
|
|
|
debug( "Your select: $v" ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Show prompt string for select item |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
See L |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=back |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 HISTORY |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
See C file |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L, L, L |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 TO DO |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
See C file |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 BUGS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
* none noted |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SEE ALSO |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L, L, L |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Serż Minus (Sergey Lepenkov) L Eabalama@cpan.orgE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 LICENSE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
82
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See C file and L |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
2
|
|
|
2
|
|
79
|
use vars qw/ $VERSION /; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
115
|
|
89
|
|
|
|
|
|
|
$VERSION = '1.00'; |
90
|
|
|
|
|
|
|
|
91
|
2
|
|
|
2
|
|
12
|
use base qw/CTK::Plugin/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
587
|
|
92
|
|
|
|
|
|
|
|
93
|
2
|
|
|
2
|
|
849
|
use CTK::CLI qw/cli_prompt cli_select/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
285
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__PACKAGE__->register_method( |
96
|
|
|
|
|
|
|
method => "cli_prompt", |
97
|
0
|
|
|
0
|
|
|
callback => sub { cli_prompt(@_) } |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__PACKAGE__->register_method( |
101
|
|
|
|
|
|
|
method => "cli_select", |
102
|
0
|
|
|
0
|
|
|
callback => sub { cli_select(@_) } |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |