| 1 | package App::RemoteCommand::Util; | ||||||||||
| 2 | 1 | ▶ | use v5.24; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use experimental qw(lexical_subs signatures); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Exporter 'import'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | our @EXPORT_OK = qw(prompt DEBUG logger); | |||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use constant DEBUG => $ENV{PERL_RCOMMAND_DEBUG} ? 1 : 0; | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use Term::ReadKey 'ReadMode'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub logger (@args) { | ||||||||
|
Subroutine
logger: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 14 | 0 | ▶ | my $msg = @args == 1 ? $args[0] : sprintf shift(@args), @args; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | warn " | $msg\n"; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub prompt ($msg) { | ||||||||
|
Subroutine
prompt: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 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 | ▶ | local $SIG{INT} = sub (@) { die $SIGNAL }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 26 | 0 | $answer = <STDIN>; | |||||||||
| 27 | }; | ||||||||||
| 28 | 0 | my $error = $@; | |||||||||
| 29 | 0 | ReadMode 'restore', \*STDIN; | |||||||||
| 30 | 0 | print "\n"; | |||||||||
| 31 | 0 | ▶ | die $error if $error; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | chomp $answer; | |||||||||
| 33 | 0 | $answer; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 1 | 1; | |||||||||