blib/lib/App/RecordStream/Operation/help/FromManual.pm

filter: Statementstmt 46.3% 19 / 41 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 4 totaltotal 31.6% 25 / 79 CC 10 SCAR 34.9
CC
10
Cov
31%
pod_file
72.0
manual_class
12.0
init
2.0
CRAP 32.7
« blib/lib/App/RecordStream/Operation/fromapache.pm ↑ Summary blib/lib/App/RecordStream/Operation/toptable.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package App::RecordStream::Operation::help::FromManual;
5 1 ▶use base qw(App::RecordStream::Operation::help);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Pod::Perldoc;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use File::Temp qw< tempfile >;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Scalar::Util qw< blessed >;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub init_help {}
Subroutine init_help: not called CC=1 SCAR=0.0
Pod undocumented
12 0 ▶sub init {
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
13 0 my $this = shift;
14 0 local @ARGV = ('-F', $this->pod_file);
15 0 Pod::Perldoc->run();
16 }
17  
18 0 ▶sub pod_file {
Subroutine pod_file: not called CC=8 SCAR=42.8
Pod undocumented
19 0 my $this = shift;
20 0 my ($class, $pm) = $this->manual_class;
21 0 my $source = $INC{$pm};
22  
23 # Simple case: manual class is on disk already
24 0 ▶ if (not ref $source and -e $source) {
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $source and -e $source) { } 0 0 0
elsif (ref $source and builtin::blessed($source) =~ /^FatPacked::/) { } 0 0 0
Condition0%0/3
not ref $source and -e $source
!ll&&!rl&&r
000
MC/DC0%0/2
not ref $source and -e $source
not ref $source -e $source
Truth table0%0/3
not(A) and B
A= not ref $sourceB= -e $source
ABresult
0X0
100
111
25 0 return $source;
26 }
27 # Fatpacked: read from the @INC hook
28 ▶ elsif (ref $source and blessed($source) =~ /^FatPacked::/) {
Condition0%0/3
ref $source and builtin::blessed($source) =~ /^FatPacked::/
!ll&&!rl&&r
000
MC/DC0%0/2
ref $source and builtin::blessed($source) =~ /^FatPacked::/
ref $source builtin::blessed($source) =~ /^FatPacked::/
Truth table0%0/3
A and B
A= ref $sourceB= builtin::blessed($source) =~ /^FatPacked::/
ABresult
0X0
100
111
29 0 ▶ my $source_fh = $source->INC($pm)
Branch: 1 branch
BranchTrueFalseTotal
my $source_fh = $source->INC($pm) or die "FatPacked INC entry failed?!" 0 0 0
30 or die "FatPacked INC entry failed?!";
31  
32 0 my ($tmp, $tmpfile) = tempfile( UNLINK => 1, TMPDIR => 1, SUFFIX => '.pm' );
33 0 ▶ print { $tmp } $_ while <$source_fh>;
Branch: 1 branch
BranchTrueFalseTotal
defined($_ = readline $source_fh) and do { print {$tmp;} $_ } 0 0 0
34 0 ▶ close $tmp
Branch: 1 branch
BranchTrueFalseTotal
close $tmp or die "failed to close tempfile $tmpfile after writing: $!" 0 0 0
35 or die "failed to close tempfile $tmpfile after writing: $!";
36 0 return $tmpfile;
37 }
38 else {
39 0 die "Don't know how to read source of $class where \$INC{$pm} = $source";
40 }
41 }
42  
43 0 ▶sub manual_class {
Subroutine manual_class: not called CC=3 SCAR=24.8
Pod undocumented
44 0 my $this = shift;
45 0 my $page = (split /::/, ref $this)[-1];
46 0 my $class = "App::RecordStream::Manual::\u$page";
47 0 my $pm = "$class.pm";
48 0 $pm =~ s{::}{/}g;
49 0 ▶ require $pm
Branch: 1 branch
BranchTrueFalseTotal
require $pm or die "Can't locate manual class ${class}: $!" 0 0 0
50 or die "Can't locate manual class $class: $!";
51 0 ▶ return wantarray ? ($class, $pm) : $class;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
52 }
53  
54 1 1;
« blib/lib/App/RecordStream/Operation/fromapache.pm ↑ Summary blib/lib/App/RecordStream/Operation/toptable.pm »