BCSSH/Pod.pm

filter: Statementstmt 13.7% 10 / 73 Branchbran 0.0% 0 / 48 Conditioncond 0.0% 0 / 27 MC/DCmcdc 0.0% 0 / 18 Subroutinesub 33.3% 3 / 9 Podpod 50.0% 1 / 2 totaltotal 7.9% 14 / 177 CC 34 SCAR 55.6
CC
34
Cov
7%
_pull_OPTIONS
462.0
parse
110.0
_pull_head1_text
30.0
CRAP 261.0
↑ Summary BCSSH/Command/ssh.pm »
1 package App::BCSSH::Pod;
2 1 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use base qw(Pod::Simple::PullParser Pod::Simple::Text);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Module::Reader qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
9 0 my $class = shift;
10 0 my $self = $class->Pod::Simple::PullParser::new;
11 0 my $alt = $class->Pod::Simple::Text::new;
12 0 @$self{keys %$alt} = values %$alt;
13 0 return $self;
14 }
15  
16 0 ▶sub parse {
Subroutine parse: not called CC=10 SCAR=47.0
Pod undocumented
17 0 ▶ my $self = ref $_[0] ? shift : shift->new;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
18 0 my $source = shift;
19 0 my $fh = module_handle($source, { found => \%INC } );
20 0 $self->set_source($fh);
21  
22 0 my %return;
23 0 local $self->{_return} = \%return;
24  
25 0 ▶ while (my $token = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $self->get_token) 0 0 0
26 0 ▶ if ($token->is_start && $token->tagname eq 'head1') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->is_start and $token->tagname eq "head1") 0 0 0
Condition0%0/3
$token->is_start and $token->tagname eq "head1"
!ll&&!rl&&r
000
MC/DC0%0/2
$token->is_start and $token->tagname eq "head1"
$token->is_start $token->tagname eq "head1"
Truth table0%0/3
A and B
A= $token->is_startB= $token->tagname eq "head1"
ABresult
0X0
100
111
27 0 my $next = $self->get_token;
28 0 ▶ if ($next->is_text and my $meth = $self->can('_pull_' . $next->text)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next->is_text and my $meth = $self->can('_pull_' . $next->text)) { } 0 0 0
Condition0%0/3
$next->is_text and my $meth = $self->can('_pull_' . $next->text)
!ll&&!rl&&r
000
MC/DC0%0/2
$next->is_text and my $meth = $self->can('_pull_' . $next->text)
$next->is_text my $meth = $self->can('_pull_' . $next->text)
Truth table0%0/3
A and B
A= $next->is_textB= my $meth = $self->can('_pull_' . $next->text)
ABresult
0X0
100
111
29 0 ▶ while (my $ff = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ff = $self->get_token) 0 0 0
30 0 ▶ last if $ff->is_end && $ff->tag eq 'head1';
Branch: 1 branch
BranchTrueFalseTotal
if $ff->is_end and $ff->tag eq "head1" 0 0 0
Condition0%0/3
$ff->is_end and $ff->tag eq "head1"
!ll&&!rl&&r
000
MC/DC0%0/2
$ff->is_end and $ff->tag eq "head1"
$ff->is_end $ff->tag eq "head1"
Truth table0%0/3
A and B
A= $ff->is_endB= $ff->tag eq "head1"
ABresult
0X0
100
111
31 }
32 0 $self->$meth();
33 }
34 else {
35 0 $self->unget_token($next);
36 }
37 }
38 }
39 0 return \%return;
40 }
41  
42 0 ▶sub _pull_NAME {
Subroutine _pull_NAME: not called CC=1 SCAR=6.9
43 0 my $self = shift;
44 0 my $abstract = $self->_pull_head1_text;
45 0 $abstract =~ s/.*?\s+-\s+//;
46 0 $self->{_return}{abstract} = $abstract;
47 }
48  
49 0 ▶sub _pull_SYNOPSIS {
Subroutine _pull_SYNOPSIS: not called CC=1 SCAR=6.9
50 0 my $self = shift;
51 0 $self->{_return}{synopsis} = $self->_pull_head1_text;
52 }
53  
54 0 ▶sub _pull_head1_text {
Subroutine _pull_head1_text: not called CC=5 SCAR=34.0
55 0 my $self = shift;
56 0 my $text = '';
57 0 ▶ while (my $next = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $next = $self->get_token) 0 0 0
58 0 ▶ $text .= $next->text if $next->is_text;
Branch: 1 branch
BranchTrueFalseTotal
if $next->is_text 0 0 0
59 0 ▶ if ($next->is_start && $next->tag =~ /^[a-z]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next->is_start and $next->tag =~ /^[a-z]/) 0 0 0
Condition0%0/3
$next->is_start and $next->tag =~ /^[a-z]/
!ll&&!rl&&r
000
MC/DC0%0/2
$next->is_start and $next->tag =~ /^[a-z]/
$next->is_start $next->tag =~ /^[a-z]/
Truth table0%0/3
A and B
A= $next->is_startB= $next->tag =~ /^[a-z]/
ABresult
0X0
100
111
60 0 $self->unget_token($next);
61 0 last;
62 }
63 }
64 0 return $text;
65 }
66  
67 0 ▶sub _pull_OPTIONS {
Subroutine _pull_OPTIONS: not called CC=21 SCAR=61.4
68 0 my $self = shift;
69 0 my %options;
70 0 $self->{_return}{options} = \%options;
71 0 ▶ while (my $ff = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $ff = $self->get_token) 0 0 0
72 0 ▶ last if $ff->is_start && $ff->tag =~ /^over-/;
Branch: 1 branch
BranchTrueFalseTotal
if $ff->is_start and $ff->tag =~ /^over-/ 0 0 0
Condition0%0/3
$ff->is_start and $ff->tag =~ /^over-/
!ll&&!rl&&r
000
MC/DC0%0/2
$ff->is_start and $ff->tag =~ /^over-/
$ff->is_start $ff->tag =~ /^over-/
Truth table0%0/3
A and B
A= $ff->is_startB= $ff->tag =~ /^over-/
ABresult
0X0
100
111
73 }
74 0 ▶ while (my $items = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $items = $self->get_token) 0 0 0
75 last
76 0 ▶ if $items->is_end && $items->tag =~ /^over-/;
Branch: 1 branch
BranchTrueFalseTotal
if $items->is_end and $items->tag =~ /^over-/ 0 0 0
Condition0%0/3
$items->is_end and $items->tag =~ /^over-/
!ll&&!rl&&r
000
MC/DC0%0/2
$items->is_end and $items->tag =~ /^over-/
$items->is_end $items->tag =~ /^over-/
Truth table0%0/3
A and B
A= $items->is_endB= $items->tag =~ /^over-/
ABresult
0X0
100
111
77 next
78 0 ▶ unless $items->is_start && $items->tag =~ /^item-/;
Branch: 1 branch
BranchTrueFalseTotal
unless $items->is_start and $items->tag =~ /^item-/ 0 0 0
Condition0%0/3
$items->is_start and $items->tag =~ /^item-/
!ll&&!rl&&r
000
MC/DC0%0/2
$items->is_start and $items->tag =~ /^item-/
$items->is_start $items->tag =~ /^item-/
Truth table0%0/3
A and B
A= $items->is_startB= $items->tag =~ /^item-/
ABresult
0X0
100
111
79  
80 0 my $option = '';
81 0 ▶ while (my $opt = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $opt = $self->get_token) 0 0 0
82 0 ▶ last if $opt->is_end && $opt->tag =~ /^item-/;
Branch: 1 branch
BranchTrueFalseTotal
if $opt->is_end and $opt->tag =~ /^item-/ 0 0 0
Condition0%0/3
$opt->is_end and $opt->tag =~ /^item-/
!ll&&!rl&&r
000
MC/DC0%0/2
$opt->is_end and $opt->tag =~ /^item-/
$opt->is_end $opt->tag =~ /^item-/
Truth table0%0/3
A and B
A= $opt->is_endB= $opt->tag =~ /^item-/
ABresult
0X0
100
111
83 0 ▶ $option .= $opt->text if $opt->is_text;
Branch: 1 branch
BranchTrueFalseTotal
if $opt->is_text 0 0 0
84 }
85  
86 0 my $opt_text = '';
87 0 my $depth = 1;
88 0 open my $fh, '>', \$opt_text;
89 0 local $self->{output_fh} = $fh;
90 0 ▶ while (my $opt = $self->get_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $opt = $self->get_token) 0 0 0
91 0 ▶ if (! $opt->is_text && $opt->tag =~ /^over-/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $opt->is_text and $opt->tag =~ /^over-/) 0 0 0
Condition0%0/3
not $opt->is_text and $opt->tag =~ /^over-/
!ll&&!rl&&r
000
MC/DC0%0/2
not $opt->is_text and $opt->tag =~ /^over-/
not $opt->is_text $opt->tag =~ /^over-/
Truth table0%0/3
not(A) and B
A= not $opt->is_textB= $opt->tag =~ /^over-/
ABresult
0X0
100
111
92 0 ▶ $depth += $opt->is_start ? 1 : -1;
Branch: 1 branch
BranchTrueFalseTotal
$opt->is_start ? : 0 0 0
93 0 ▶ last if $depth == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $depth == 0 0 0 0
94 }
95  
96 0 ▶ if ($opt->is_text) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->is_text) 0 0 0
97 0 $self->handle_text($opt->text);
98 0 next;
99 }
100 0 my $m = $opt->type . '_' . $opt->tag;
101 0 ▶ $self->can($m) or next;
Branch: 1 branch
BranchTrueFalseTotal
$self->can($m) or next 0 0 0
102  
103 0 ▶ $self->$m( $opt->is_start ? $opt->attr_hash : () );
Branch: 1 branch
BranchTrueFalseTotal
$opt->is_start ? : 0 0 0
104 }
105 0 $opt_text =~ s/^ //gm;
106 0 $opt_text =~ s/\n\n$//;
107  
108 0 $options{$option} = $opt_text;
109 }
110 }
111  
112 1 1;
113 __END__
↑ Summary BCSSH/Command/ssh.pm »