| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::RemoteCommand::Util; |
|
2
|
1
|
|
|
1
|
|
26
|
use v5.16; |
|
|
1
|
|
|
|
|
4
|
|
|
3
|
1
|
|
|
1
|
|
23
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
28
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Exporter 'import'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
90
|
|
|
6
|
|
|
|
|
|
|
our @EXPORT_OK = qw(prompt DEBUG logger); |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
50
|
|
1
|
|
7
|
use constant DEBUG => $ENV{PERL_RCOMMAND_DEBUG} ? 1 : 0; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
152
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
550
|
use Term::ReadKey 'ReadMode'; |
|
|
1
|
|
|
|
|
2031
|
|
|
|
1
|
|
|
|
|
258
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub logger { |
|
13
|
0
|
0
|
|
0
|
0
|
|
my $msg = @_ == 1 ? $_[0] : sprintf shift, @_; |
|
14
|
0
|
|
|
|
|
|
warn " | $msg\n"; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub prompt { |
|
18
|
0
|
|
|
0
|
0
|
|
my $msg = shift; |
|
19
|
0
|
|
|
|
|
|
local $| = 1; |
|
20
|
0
|
|
|
|
|
|
print $msg; |
|
21
|
0
|
|
|
|
|
|
ReadMode 'noecho', \*STDIN; |
|
22
|
0
|
|
|
|
|
|
my $SIGNAL = "Catch SIGINT\n"; |
|
23
|
0
|
|
|
|
|
|
my $answer; |
|
24
|
0
|
|
|
|
|
|
eval { |
|
25
|
0
|
|
|
0
|
|
|
local $SIG{INT} = sub { die $SIGNAL }; |
|
|
0
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$answer = ; |
|
27
|
|
|
|
|
|
|
}; |
|
28
|
0
|
|
|
|
|
|
my $error = $@; |
|
29
|
0
|
|
|
|
|
|
ReadMode 'restore', \*STDIN; |
|
30
|
0
|
|
|
|
|
|
print "\n"; |
|
31
|
0
|
0
|
|
|
|
|
die $error if $error; |
|
32
|
0
|
|
|
|
|
|
chomp $answer; |
|
33
|
0
|
|
|
|
|
|
$answer; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |