blib/lib/Xorg/XLFD.pm

filter: Statementstmt 23.2% 13 / 56 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 18.5% 18 / 97 SCAR 52.8
CC
17
Cov
15%
get_xlfd
306.0
BEGIN
1.0
BEGIN
1.0
CRAP 197.0
↑ Summary
1 package Xorg::XLFD;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 BEGIN {
5 2 ▶ use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶ use vars qw($VERSION @ISA @EXPORT_OK);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶ $VERSION = '0.128';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 @ISA = qw(Exporter);
11  
12 2 @EXPORT_OK = qw(get_xlfd);
13  
14 };
15  
16 sub get_xlfd {
17 0 ▶ my $fam = shift; # fixed
Subroutine get_xlfd: not called CC=17 SCAR=57.2
Pod documented
18 0 my %fonts;
19  
20 0 ▶ open(my $fh, '-|', 'xlsfonts') or croak("xlsfonts: $!\n");
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "-|", "xlsfonts" or croak("xlsfonts: $!\n") 0 0 0
21  
22 0 ▶ while(<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
23 0 chomp;
24 0 $_ =~ s/^-//;
25 0 my($foundary, $family, $weight, $slant, $set_width, $pixels, $tenths,
26 $h_dpi, $v_dpi, $spacing, $avg_width, $charset)
27 = split(/--?/, $_);
28  
29 0 ▶ if( ($family =~ /^\d+$/m) or ($family eq '') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($family =~ /^\d+$/m or $family eq "") 0 0 0
Condition0%0/3
$family =~ /^\d+$/m or $family eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
$family =~ /^\d+$/m or $family eq ""
$family =~ /^\d+$/m $family eq ""
Truth table0%0/3
A or B
A= $family =~ /^\d+$/mB= $family eq ""
ABresult
1X1
011
000
30 0 next;
31 }
32  
33 0 push(@{$fonts{family}->{$family}->{weight}}, $weight)
34 0 ▶ unless $weight ~~ @{$fonts{family}->{$family}->{weight}};
Branch: 1 branch
BranchTrueFalseTotal
unless $weight ~~ \@{$fonts{"family"}{$family}{"weight"};} 0 0 0
35  
36 0 push(@{$fonts{family}->{$family}->{width}}, $avg_width)
37 0 ▶ unless $avg_width ~~ @{$fonts{family}->{$family}->{width}};
Branch: 1 branch
BranchTrueFalseTotal
unless $avg_width ~~ \@{$fonts{"family"}{$family}{"width"};} 0 0 0
38  
39 0 push(@{$fonts{family}->{$family}->{vert_dpi}}, $v_dpi)
40 0 ▶ unless $v_dpi ~~ @{$fonts{family}->{$family}->{vert_dpi}};
Branch: 1 branch
BranchTrueFalseTotal
unless $v_dpi ~~ \@{$fonts{"family"}{$family}{"vert_dpi"};} 0 0 0
41  
42 0 push(@{$fonts{family}->{$family}->{horiz_dpi}}, $h_dpi)
43 0 ▶ unless $h_dpi ~~ @{$fonts{family}->{$family}->{horiz_dpi}};
Branch: 1 branch
BranchTrueFalseTotal
unless $h_dpi ~~ \@{$fonts{"family"}{$family}{"horiz_dpi"};} 0 0 0
44  
45 0 push(@{$fonts{family}->{$family}->{tenths}}, $tenths)
46 0 ▶ unless $tenths ~~ @{$fonts{family}->{$family}->{tenths}};
Branch: 1 branch
BranchTrueFalseTotal
unless $tenths ~~ \@{$fonts{"family"}{$family}{"tenths"};} 0 0 0
47  
48 0 push(@{$fonts{family}->{$family}->{spacing}}, $spacing)
49 0 ▶ unless $spacing ~~ @{$fonts{family}->{$family}->{spacing}};
Branch: 1 branch
BranchTrueFalseTotal
unless $spacing ~~ \@{$fonts{"family"}{$family}{"spacing"};} 0 0 0
50  
51 0 push(@{$fonts{family}->{$family}->{slant}}, $slant)
52 0 ▶ unless $slant ~~ @{$fonts{family}->{$family}->{slant}};
Branch: 1 branch
BranchTrueFalseTotal
unless $slant ~~ \@{$fonts{"family"}{$family}{"slant"};} 0 0 0
53  
54 0 push(@{$fonts{family}->{$family}->{'set width'}}, $set_width)
55 0 ▶ unless $set_width ~~ @{$fonts{family}->{$family}->{'set width'}};
Branch: 1 branch
BranchTrueFalseTotal
unless $set_width ~~ \@{$fonts{"family"}{$family}{"set width"};} 0 0 0
56  
57 0 push(@{$fonts{family}->{$family}->{pixels}}, $pixels)
58 0 ▶ unless $pixels ~~ @{$fonts{family}->{$family}->{pixels}};
Branch: 1 branch
BranchTrueFalseTotal
unless $pixels ~~ \@{$fonts{"family"}{$family}{"pixels"};} 0 0 0
59  
60 0 push(@{$fonts{family}->{$family}->{charset}}, $charset)
61 0 ▶ unless $charset ~~ @{$fonts{family}->{$family}->{charset}};
Branch: 1 branch
BranchTrueFalseTotal
unless $charset ~~ \@{$fonts{"family"}{$family}{"charset"};} 0 0 0
62  
63 0 push(@{$fonts{family}->{$family}->{foundary}}, $foundary)
64 0 ▶ unless $foundary ~~ @{$fonts{family}->{$family}->{foundary}};
Branch: 1 branch
BranchTrueFalseTotal
unless $foundary ~~ \@{$fonts{"family"}{$family}{"foundary"};} 0 0 0
65  
66 }
67 return (exists($fonts{family}{$fam}))
68 0 ▶ ? $fonts{family}{$fam}
Branch: 1 branch
BranchTrueFalseTotal
exists $fonts{'family'}{$fam} ? : 0 0 0
69 : \%fonts
70 ;
71 }
72  
73  
74 2 1;
75  
76  
77 __END__
↑ Summary