Branch Coverage

blib/lib/Parse/BBCode.pm
Criterion Covered Total %
branch 195 210 92.8


line true false branch
30 6 31 if (not $args{'tags'}) { }
36 34 3 if (not $args{'escapes'}) { }
65 42 0 if not $seen{$_}++
78 9 28 if (exists $$defs{''}) { }
80 8 1 if (ref $plain eq 'CODE')
88 6 22 if ($url_finder)
90 0 6 unless ($result)
98 5 23 if ($text_processor)
101 1 27 if ($smileys and ref $$smileys{'icons'} eq 'HASH') { }
128 6 22 if ($url_finder) { }
130 1 5 if (ref $url_finder eq 'CODE') { }
134 1 4 unless (ref $url_finder eq 'HASH')
145 1 1 if ($max_url and length $title > $max_url)
160 6 3 if (not $$info{'classes'}{'url'}) { }
166 8 1 if $linebreaks
174 232 2 if $linebreaks
185 186 88 if (not ref $def) { }
8 160 elsif (not exists $$def{'code'} and exists $$def{'output'}) { }
194 234 40 unless defined $$defs{$key}{'classic'}
195 35 239 unless defined $$defs{$key}{'close'}
209 8 186 if (ref $def eq 'HASH') { }
213 1 7 if exists $$new_def{'close'}
214 6 2 if exists $$new_def{'class'}
220 43 151 if ($output =~ s/^(inline|block|url)://)
227 305 469 if ($p =~ /$re_cmp/) { }
231 161 144 if (grep {$_ eq 'parse';} @escapes)
247 468 292 if (not ref $c) { }
256 4 288 if ($type eq 'attr' and @$attributes > 1) { }
13 275 elsif ($type eq 'a') { }
57 218 elsif ($type eq 'A') { }
217 1 elsif ($type eq 's') { }
259 4 0 if ($$item[0] eq $name)
272 208 9 if (ref $string eq 'SCALAR')
280 91 198 if ($sub)
282 5 86 unless (defined $var)
307 3 518 unless defined(my $code = $self->get_plain)
313 3 189 $self->get_attribute_parser ? :
330 109 215 if (@opened) { }
335 14 201 if (@tags and not ref $tags[-1]) { }
351 126 198 if (@opened) { }
191 7 elsif (ref $tag) { }
355 6 120 if (ref $tag and $class =~ /inline|url/ and $tag->get_class eq 'block') { }
105 15 elsif (ref $tag) { }
359 2 4 if ($self->get_close_open_tags) { }
376 96 9 if ($parse) { }
383 1 7 if (ref $c) { }
401 155 36 if ($parse) { }
408 2 33 if (ref $c) { }
434 29 482 if ($re_classic and $re_short) { }
0 482 elsif (not $re_classic and $re_short) { }
482 0 elsif ($re_classic and not $re_short) { }
458 313 198 if (length $before)
473 207 33 if ($try->get_name eq lc $name) { }
25 8 elsif (not $try->get_close) { }
484 1 7 if ($self->get_close_open_tags) { }
488 1 0 if (@opened)
499 22 185 if (@not_close)
507 207 0 if ($f)
508 185 22 unless (@not_close)
522 10 501 if (defined $tag1)
526 8 2 if ($after =~ s( :// ([^\[]+) \] )[]x) { }
529 4 4 defined $title && length $title ? :
541 1 7 if ($in_url and $tag->get_class eq 'url') { }
559 341 160 if ($after) { }
1 159 elsif ($tag) { }
566 335 6 if ($ok) { }
568 0 335 unless defined $attr
588 24 120 if ($last and not $last->get_close and not $close)
595 3 332 if ($open->get_single and not $nested_url) { }
331 1 elsif (not $nested_url) { }
604 287 44 if ($parse) { }
612 39 5 if ($after =~ s( (.*?) (\[ / $tag \]) )[]six) { }
645 8 184 if ($self->get_close_open_tags) { }
658 192 0 if ($scalar_util) { }
693 3 8 if ($type and $$errors{$type}) { }
6 2 elsif (keys %$errors) { }
704 1 191 if (@_ < 2)
711 18 173 if ($self->get_error)
735 502 521 if (ref $tree) { }
755 495 7 if (($tree->get_type || 'classic') eq 'classic') { }
756 94 401 defined $attr && length $attr ? :
760 3 4 @$content ? :
762 401 101 if (ref $fallback)
769 290 212 if ($self->get_strip_linebreaks and ($tree->get_class || '') eq 'block')
770 75 215 if (@$content == 1 and not ref $$content[0] and defined $$content[0]) { }
175 40 elsif (@$content > 1) { }
775 56 119 if (not ref $$content[0] and defined $$content[0])
778 155 20 if (not ref $$content[-1] and defined $$content[-1])
783 462 40 if (not exists $$defs{$name}{'parse'} or $parse) { }
791 311 191 if ($code) { }
809 4 529 unless defined $str
825 333 4 if ($self->get_direct_attribute and $$text =~ s/^(=[^\]]*)?]// or $$text =~ s/^( [^\]]*)?\]//)
832 235 98 unless defined $attr
834 235 98 unless (length $attr)
837 97 1 if ($self->get_direct_attribute)
840 1 97 if ($self->get_strict_attributes and not length $attr)
844 96 1 if (length $attribute_quote == 1) { }
845 96 0 if ($attr =~ s/^(?:$attribute_quote(.+?)$attribute_quote(?:\s+|$)|(.*?)(?:\s+|$))//)
846 25 71 defined $1 ? :
851 7 2 defined $2 ? :
856 1 0 if ($attr =~ s/^(?:(["'])(.+?)\1|(.*?)(?:\s+|$))//)
857 0 1 defined $2 ? :
862 1 0 defined $3 ? :
866 1 0 if ($self->get_strict_attributes and length $attr and $attr =~ tr/ /\000-\037!-\377/c)
880 312 0 unless ($tag->get_finished)