ZIO_Tools.pm

filter: Statementstmt 37.5% 9 / 24 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 26.1% 11 / 42 CC 7 SCAR 32.8
CC
7
Cov
25%
set_xterm_title
42.0
find_module
6.0
BEGIN
1.0
CRAP 26.6
« ZInterpreter.pm ↑ Summary ZIO_Termcap.pm »
1 package Games::Rezrov::ZIO_Tools;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 @Games::Rezrov::ZIO_Tools::ISA = qw(Exporter);
7 1 @Games::Rezrov::ZIO_Tools::EXPORT = qw(set_xterm_title
8 find_module);
9  
10 0 ▶sub set_xterm_title {
Subroutine set_xterm_title: not called CC=6 SCAR=37.4
Pod undocumented
11 # if title is not defined, return whether or not the title *can* be
12 # changed.
13 0 my $title = shift;
14 # see the comp.windows.x FAQ.
15 0 ▶ if ($ENV{"DISPLAY"}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"DISPLAY"}) 0 0 0
16 # these are X-specific, so...
17 0 my $term = $ENV{"TERM"};
18 0 my $esc = pack 'c', 27;
19 # escape
20  
21 0 ▶ if ($term =~ /xterm/i) {
Branch: 2 branches
BranchTrueFalseTotal
if ($term =~ /xterm/i) { } 0 0 0
elsif ($term eq 'vt300') { } 0 0 0
22 # XTerm
23 0 ▶ if (defined $title) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $title) { } 0 0 0
24 0 printf "%s]2;%s%s", $esc, $title, pack('c', 7); # bell
25 } else {
26 0 return 1;
27 }
28 } elsif ($term eq "vt300") {
29 # DECTerm?
30 0 ▶ if (defined $title) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $title) { } 0 0 0
31 0 printf '%s]21;%s%s\\', $esc, $title, $esc;
32 } else {
33 0 return 1;
34 }
35 }
36 }
37  
38 0 return 0;
39 }
40  
41 0 ▶sub find_module {
Subroutine find_module: not called CC=2 SCAR=17.9
Pod undocumented
42 #
43 # Determine whether or not a given Perl module or library is installed
44 #
45 0 my $cmd = 'use ' . $_[0];
46 0 eval $cmd;
47 0 ▶ return $@ ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$@ ? : 0 0 0
48 }
49  
50 1 1;
« ZInterpreter.pm ↑ Summary ZIO_Termcap.pm »