File Coverage

lib/Term/ReadLine/Perl5/TermCap.pm
Criterion Covered Total %
statement 0 18 0.0
branch 0 12 0.0
condition 0 4 0.0
subroutine 0 2 0.0
pod 0 2 0.0
total 0 38 0.0


line stmt bran cond sub pod time code
1             =encoding utf8
2              
3             =head1 Term::ReadLine::Perl5::TermCap
4              
5             This is copied from L to remove the cyclic dependency
6             I -> I -> I
7             With this, I have modifed I to no longer depend
8             on I.
9              
10             =cut
11              
12             package Term::ReadLine::Perl5::TermCap;
13              
14             # Prompt-start, prompt-end, command-line-start, command-line-end
15             # -- zero-width beautifies to emit around prompt and the command line.
16             our @rl_term_set = ("","","","");
17             # string encoded:
18             our $rl_term_set = ',,,';
19              
20             our $terminal;
21             sub LoadTermCap {
22 0 0   0 0   return if defined $terminal;
23              
24 0           require Term::Cap;
25 0           $terminal = Tgetent Term::Cap ({OSPEED => 9600}); # Avoid warning.
26             }
27              
28             sub ornaments {
29 0     0 0   shift;
30 0 0         return $rl_term_set unless @_;
31 0           $rl_term_set = shift;
32 0   0       $rl_term_set ||= ',,,';
33 0 0         $rl_term_set = 'us,ue,md,me' if $rl_term_set eq '1';
34 0           my @ts = split /,/, $rl_term_set, 4;
35 0           eval { LoadTermCap };
  0            
36 0 0         unless (defined $terminal) {
37 0 0         warn("Cannot find termcap: $@\n") unless $Term::ReadLine::termcap_nowarn;
38 0           $rl_term_set = ',,,';
39 0           return;
40             }
41 0 0 0       @rl_term_set = map {$_ ? $terminal->Tputs($_,1) || '' : ''} @ts;
  0            
42 0           return $rl_term_set;
43             }
44              
45             1;