| 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
Condition66%2/3
$opts and ref $opts eq "HASH"
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"
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 16 | for my $key (keys %$opts) | |||||||||||||||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 33 | ▶ | if ($key eq 'attributes' && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$key eq "attributes" and ref $self->{"options"}{"attributes"} eq "HASH" and ref $opts->{"attributes"} eq "HASH"
$key eq "attributes" and ref $self->{"options"}{"attributes"} eq "HASH"
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"
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||