blib/lib/PPI/Xref/Help.pm

filter: Statementstmt 3.5% 1 / 28 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 3 totaltotal 1.8% 1 / 55 CC 11 SCAR 37.3
CC
11
Cov
2%
man_help
56.0
short_help
30.0
long_help
2.0
CRAP 41.8
↑ Summary blib/lib/PPI/Xref.pm »
1 package PPI::Xref::Help;
2  
3 0 ▶sub short_help {
Subroutine short_help: not called CC=5 SCAR=34.0
Pod undocumented
4 0 my ($name, $fh) = @_;
5 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
6 0 ▶ last if /^=head2 Usage/;
Branch: 1 branch
BranchTrueFalseTotal
if /^=head2 Usage/ 0 0 0
7 }
8 0 ▶ while (<$fh>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
9 0 ▶ last if /^=head2/;
Branch: 1 branch
BranchTrueFalseTotal
if /^=head2/ 0 0 0
10 0 print;
11 }
12 0 exit(1);
13 }
14  
15 0 ▶sub long_help {
Subroutine long_help: not called CC=1 SCAR=6.9
Pod undocumented
16 0 my ($name, $fh) = @_;
17 0 print <$fh>;
18 0 exit(1);
19 }
20  
21 0 ▶sub man_help {
Subroutine man_help: not called CC=7 SCAR=40.3
Pod undocumented
22 0 my ($name, $fh) = @_;
23 0 my $man_pipe = "| pod2man --name '$name' | nroff -man";
24 0 my $pager = $ENV{PAGER};
25 0 ▶ unless (defined $pager) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pager) 0 0 0
26 0 $pager = "less"; # Might be assuming too much.
27 }
28 0 ▶ if ($pager =~ /less/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pager =~ /less/) 0 0 0
29 0 ▶ my $less_opts = $ENV{LESS} // "";
Condition0%0/2
$ENV{"LESS"} // ""
l!l
00
MC/DC0%0/1
$ENV{"LESS"} // ""
$ENV{"LESS"}
Truth table0%0/2
A
A= $ENV{"LESS"}
Aresult
11
00
30 0 ▶ if ($less_opts !~ /-R/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($less_opts =~ /-R/) 0 0 0
31 0 $less_opts .= " -R"
32 }
33 0 $pager .= " $less_opts";
34 }
35 0 ▶ if (defined $pager) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pager) 0 0 0
36 0 $man_pipe .= " | $pager";
37 }
38 0 ▶ if (open(my $man_fh, $man_pipe)) {
Branch: 1 branch
BranchTrueFalseTotal
if (open my $man_fh, $man_pipe) 0 0 0
39 0 print { $man_fh } <$fh>;
40 0 close($man_fh);
41 }
42 0 exit(1);
43 }
44  
45 1 1;
↑ Summary blib/lib/PPI/Xref.pm »