blib/lib/Text/MarkdownAdoc.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 75.0% 3 / 4 Conditioncond 55.5% 5 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 78.1% 43 / 55 CC 7 SCAR 16.9
CC
7
Cov
81%
convert
8.6
BEGIN
1.0
BEGIN
1.0
CRAP 5.4
« script/markdown-adoc ↑ Summary /usr/local/bin/perldoc »
1 package Text::MarkdownAdoc;
2  
3 17 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 17 ▶use Text::MarkdownAdoc::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 17 our $VERSION = '0.1.1';
10  
11 #===========================================================================
12 # Public OO Facade
13 #===========================================================================
14  
15 sub new
16 16 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod documented
17 16 my ($class, %opts) = @_;
18  
19 16 my $self = {options => {%opts},};
20  
21 16 bless $self, $class;
22 16 return $self;
23 }
24  
25 sub convert
26 186 ▶{
Subroutine convert: called CC=7 SCAR=21.5
Pod documented
27 186 my ($self, $text, $opts) = @_;
28  
29 # Merge constructor defaults with per-call overrides.
30 # attributes hashes are merged key-by-key.
31 186 my %merged = %{$self->{options}};
32 186 ▶ if ($opts && ref $opts eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if ($opts and ref $opts eq "HASH") 16 170 186
Condition66%2/3
$opts and ref $opts eq "HASH"
!ll&&!rl&&r
170016
MC/DC50%1/2
$opts and ref $opts eq "HASH"
$opts ref $opts eq "HASH"
Truth table66%2/3
A and B
A= $optsB= ref $opts eq "HASH"
ABresult
0X0
100
111
33 {
34 16 for my $key (keys %$opts)
35 {
36 33 ▶ if ($key eq 'attributes' &&
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'attributes' and ref $self->{'options'}{'attributes'} eq 'HASH' and ref $opts->{'attributes'} eq 'HASH') { } 0 33 33
Condition50%3/6
$key eq "attributes" and ref $self->{"options"}{"attributes"} eq "HASH" and ref $opts->{"attributes"} eq "HASH"
!ll&&!rl&&r
3300
$key eq "attributes" and ref $self->{"options"}{"attributes"} eq "HASH"
!ll&&!rl&&r
3210
MC/DC0%0/3
$key eq "attributes" and ref $self->{"options"}{"attributes"} eq "HASH" and ref $opts->{"attributes"} eq "HASH"
$key eq "attributes" ref $self->{"options"}{"attributes"} eq "HASH" ref $opts->{"attributes"} eq "HASH"
Truth table50%2/4
A and B and C
A= $key eq "attributes"B= ref $self->{"options"}{"attributes"} eq "HASH"C= ref $opts->{"attributes"} eq "HASH"
ABCresult
0XX0
10X0
1100
1111
37 ref $self->{options}{attributes} eq 'HASH' &&
38 ref $opts->{attributes} eq 'HASH')
39 {
40 0 $merged{attributes} = {%{$self->{options}{attributes}}, %{$opts->{attributes}},};
41 }
42 else
43 {
44 33 $merged{$key} = $opts->{$key};
45 }
46 }
47 }
48  
49 # Delegate to the parser
50 186 my $parser = Text::MarkdownAdoc::Parser->new(%merged);
51 186 return $parser->parse($text);
52 }
53  
54 17 1;
55  
56 __END__
« script/markdown-adoc ↑ Summary /usr/local/bin/perldoc »