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