Tak/REPL.pm

filter: Statementstmt 33.3% 8 / 24 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 0.0% 0 / 1 totaltotal 26.3% 10 / 38 SCAR 31.0
CC
6
Cov
24%
run
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 22.1
« Tak/STDIOSetup.pm ↑ Summary Tak/Loop.pm »
1 package Tak::REPL;
2  
3 1 ▶use Term::ReadLine;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 has client => (is => 'ro', required => 1);
7  
8 sub run {
9 0 ▶ my $client = $_[0]->client;
Subroutine run: not called CC=6 SCAR=37.4
Pod undocumented
10 0 my $read = Term::ReadLine->new('REPL');
11  
12 0 while (1) {
13 0 my $line = $read->readline('re.pl$ ');
14 0 ▶ last unless defined $line;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $line 0 0 0
15 0 ▶ next unless length $line;
Branch: 1 branch
BranchTrueFalseTotal
unless length $line 0 0 0
16 0 my $result = $client->do(eval => $line);
17 print exists($result->{return})
18 ? $result->{return}
19 0 ▶ : "Error: ".$result->{exception};
Branch: 1 branch
BranchTrueFalseTotal
exists $result->{'return'} ? : 0 0 0
20 0 ▶ if ($result->{stdout}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result->{"stdout"}) 0 0 0
21 0 chomp($result->{stdout});
22 0 print "STDOUT:\n${\$result->{stdout}}\n";
23 }
24 0 ▶ if ($result->{stderr}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result->{"stderr"}) 0 0 0
25 0 chomp($result->{stderr});
26 0 print "STDERR:\n${\$result->{stderr}}\n";
27 }
28 }
29 }
30  
31 1 1;
« Tak/STDIOSetup.pm ↑ Summary Tak/Loop.pm »