lib/Term/ReadLine/Perl5/TermCap.pm

filter: Statementstmt 18.1% 4 / 22 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 2 totaltotal 9.0% 4 / 44 CC 9 SCAR 40.7
CC
9
Cov
11%
ornaments
72.0
LoadTermCap
6.0
CRAP 58.8
« blib/lib/Term/ReadLine/Perl5/OO/Keymap.pm ↑ Summary blib/lib/Term/ReadLine/Perl5.pm »
1 =encoding utf8
2  
3 =head1 Term::ReadLine::Perl5::TermCap
4  
5 This is copied from L<Term::ReadLine> to remove the cyclic dependency
6 I<Term::ReadLine> -> I<Term::ReadLine::Perl5> -> I<Term::ReadLine>
7 With this, I have modifed I<Term::ReadLine::Perl5> to no longer depend
8 on I<Term::Readline>.
9  
10 =cut
11 package Term::ReadLine::Perl5::TermCap;
12  
13 # Prompt-start, prompt-end, command-line-start, command-line-end
14 # -- zero-width beautifies to emit around prompt and the command line.
15 11 our @rl_term_set = ("","","","");
16 # string encoded:
17 11 our $rl_term_set = ',,,';
18  
19 11 our $terminal;
20 sub LoadTermCap {
21 0 ▶ return if defined $terminal;
Subroutine LoadTermCap: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if defined $terminal 0 0 0
22  
23 0 require Term::Cap;
24 0 $terminal = Tgetent Term::Cap ({OSPEED => 9600}); # Avoid warning.
25 }
26  
27 sub ornaments {
28 0 ▶ shift;
Subroutine ornaments: not called CC=8 SCAR=42.8
Pod undocumented
29 0 ▶ return $rl_term_set unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
30 0 $rl_term_set = shift;
31 0 ▶ $rl_term_set ||= ',,,';
Condition0%0/2
$rl_term_set ||= ",,,"
l!l
00
MC/DC0%0/1
$rl_term_set ||= ",,,"
$rl_term_set
Truth table0%0/2
A
A= $rl_term_set
Aresult
11
00
32 0 ▶ $rl_term_set = 'us,ue,md,me' if $rl_term_set eq '1';
Branch: 1 branch
BranchTrueFalseTotal
if $rl_term_set eq 1 0 0 0
33 0 my @ts = split /,/, $rl_term_set, 4;
34 0 eval { LoadTermCap };
35 0 ▶ unless (defined $terminal) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $terminal) 0 0 0
36 0 ▶ warn("Cannot find termcap: $@\n") unless $Term::ReadLine::termcap_nowarn;
Branch: 1 branch
BranchTrueFalseTotal
unless $Term::ReadLine::termcap_nowarn 0 0 0
37 0 $rl_term_set = ',,,';
38 0 return;
39 }
40 0 ▶ @rl_term_set = map {$_ ? $terminal->Tputs($_,1) || '' : ''} @ts;
Branch: 1 branch
BranchTrueFalseTotal
$_ ? : 0 0 0
Condition0%0/2
$terminal->Tputs($_, 1) or ""
l!l
00
MC/DC0%0/1
$terminal->Tputs($_, 1) or ""
$terminal->Tputs($_, 1)
Truth table0%0/2
A
A= $terminal->Tputs($_, 1)
Aresult
11
00
41 0 return $rl_term_set;
42 }
43  
44 11 1;
« blib/lib/Term/ReadLine/Perl5/OO/Keymap.pm ↑ Summary blib/lib/Term/ReadLine/Perl5.pm »