blib/lib/Xorg/XLFD.pm

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