| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($token->is_start && $token->tagname eq 'head1') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$token->is_start and $token->tagname eq "head1"
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"
| |||||||||||||||||||||||||||||
| 27 | 0 | my $next = $self->get_token; | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ($next->is_text and my $meth = $self->can('_pull_' . $next->text)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next->is_text and my $meth = $self->can('_pull_' . $next->text)
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)
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | while (my $ff = $self->get_token) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | last if $ff->is_end && $ff->tag eq 'head1'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ff->is_end and $ff->tag eq "head1"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $text .= $next->text if $next->is_text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | if ($next->is_start && $next->tag =~ /^[a-z]/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next->is_start and $next->tag =~ /^[a-z]/
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]/
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | last if $ff->is_start && $ff->tag =~ /^over-/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ff->is_start and $ff->tag =~ /^over-/
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-/
| |||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | while (my $items = $self->get_token) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | last | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if $items->is_end && $items->tag =~ /^over-/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$items->is_end and $items->tag =~ /^over-/
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-/
| |||||||||||||||||||||||||||||
| 77 | next | ||||||||||||||||||||||||||||
| 78 | 0 | ▶ | unless $items->is_start && $items->tag =~ /^item-/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$items->is_start and $items->tag =~ /^item-/
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-/
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | my $option = ''; | |||||||||||||||||||||||||||
| 81 | 0 | ▶ | while (my $opt = $self->get_token) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | last if $opt->is_end && $opt->tag =~ /^item-/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opt->is_end and $opt->tag =~ /^item-/
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-/
| |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | $option .= $opt->text if $opt->is_text; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if (! $opt->is_text && $opt->tag =~ /^over-/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $opt->is_text and $opt->tag =~ /^over-/
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-/
| |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | $depth += $opt->is_start ? 1 : -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | last if $depth == 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if ($opt->is_text) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | ▶ | $self->$m( $opt->is_start ? $opt->attr_hash : () ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||