| 1 | package HTML::Obj2HTML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $HTML::Obj2HTML::VERSION = '0.12'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use HTML::Entities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Text::Markdown; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Text::Pluralize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Locale::Currency::Format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use List::MoreUtils qw(uniq); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Module::Pluggable require => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | END_TAG_OPTIONAL => 0x0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | END_TAG_REQUIRED => 0x1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | END_TAG_FORBIDDEN => 0x2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | OBSOLETE => 0x4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # storage is a sort of top-level stash for an object. It doesn't have to be used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # you can get away with building your own object variable and passing it to "gen" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | my $storage = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # Opts are simple storage that could be referred to in extensions (not typically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # in the base class). A good example is "readonly" (true/false) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | my %opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # extensions are stored here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | my %extensions = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # snippets are stored here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | my $snippets = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # A dictionary of substitutions are stored here and can be referenced in _content_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | my %dictionary; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | my $file_ext = ".po"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | my %dofiles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # Whether or not to close empty tags with / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | my $mode = "XHTML"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # Whether or not to output a warning when something that doesn't look like a valid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # html 5 tag is used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | my $warn_on_unknown_tag = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # Whether or not to use HTML::FromArrayref format ("elementname {attributes} content" triplets) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | my $html_fromarrayref_format = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # Default currency to use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | my $default_currency = "GBP"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | our $db; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Load up the extensions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | plugins(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | ▶ | my @extra = (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=10 SCAR=35.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | my $loadcomponents = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | my $ext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | while (my $opt = shift) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | if ($opt eq "components") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $arg = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $loadcomponents = $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | elsif ($opt eq "default_currency") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $default_currency = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | elsif ($opt eq "mode") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $mode = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | elsif ($opt eq "warn_on_unknown_tag") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $warn_on_unknown_tag = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | elsif ($opt eq "html_fromarrayref_format") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $html_fromarrayref_format = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | elsif ($opt eq "file_extension") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $file_ext = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $file_ext =~ s/[\/\n\r]//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | push(@extra, $opt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | if ($loadcomponents) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | foreach my $file (split("\n", `find $loadcomponents -name "*${file_ext}"`)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | chomp($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $l = $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $l =~ s/$loadcomponents\///; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $l =~ s/${file_ext}$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $l =~ s/\//::/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | #print STDERR "HTML::Obj2HTML registering component $l\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | HTML::Obj2HTML::register_extension($l, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | tag => "", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | before => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if (ref $o eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return HTML::Obj2HTML::fetch($file, $o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | return HTML::Obj2HTML::fetch($file, { _ => $o }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | my %tags = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | a => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | abbr => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | acronym => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | address => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | applet => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | area => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | article => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | aside => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | audio => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | b => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | base => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | basefont => END_TAG_FORBIDDEN | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | bdi => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | bdo => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | big => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | blockquote => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | body => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | br => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | button => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | canvas => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | caption => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | center => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | cite => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | code => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | col => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | colgroup => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | data => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | datalist => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | dd => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | del => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | details => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | dfn => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | dialog => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | dir => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | div => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | dl => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | dt => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | em => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | embed => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | fielset => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | figcaption => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | figure => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | font => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | footer => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | form => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | frame => END_TAG_FORBIDDEN | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | frameset => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | head => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | header => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | hgroup => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | h1 => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | h2 => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | h3 => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | h4 => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | h5 => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | h6 => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | hr => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | html => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | i => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | iframe => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | img => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | input => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ins => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | kbd => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | keygen => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | label => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | legend => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | li => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | link => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | main => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | map => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | mark => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | menu => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | menuitem => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | meta => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | meter => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | nav => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | noframes => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | noscript => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | object => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ol => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | optgroup => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | option => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | output => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | p => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | param => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | picture => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | pre => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | progress => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | q => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | rp => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | rt => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ruby => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | s => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | samp => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | script => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | section => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | select => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | small => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | source => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | span => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | strike => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | strong => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | style => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | sub => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | summary => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | sup => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | svp => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | table => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | tbody => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | td => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | template => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | textarea => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | tfoot => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | th => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | thead => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | time => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | title => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | tr => END_TAG_OPTIONAL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | track => END_TAG_FORBIDDEN, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | tt => END_TAG_REQUIRED | OBSOLETE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | u => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ul => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | var => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | video => END_TAG_REQUIRED, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | wbr => END_TAG_FORBIDDEN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | sub flush { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | %opt = (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flush: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | %dictionary = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $snippets = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | sub set_opt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | my $key = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_opt: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $opt{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | sub get_opt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | my $key = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_opt: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | return $opt{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | sub set_dbh { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | $db = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_dbh: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | sub set_dictionary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | my $hashref = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_dictionary: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | %dictionary = %{$hashref}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | sub add_dictionary_items { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | my $hashref = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_dictionary_items: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | %dictionary = (%dictionary, %{$hashref}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | sub set_snippet { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | my $name = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_snippet: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if (!ref $obj) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $obj = fetch($obj, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $snippets->{$name} = $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | sub get_snippet { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | my $name = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_snippet: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | return $snippets->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | sub append_snippet { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | my $name = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append_snippet: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | if (!defined $snippets->{$name}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $snippets->{$name} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } elsif (ref $snippets->{$name} ne "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | if (!ref $obj) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $obj = fetch($obj, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | push(@{$snippets->{$name}}, $obj); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | sub do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | HTML::Obj2HTML::print($storage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | $storage = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | sub sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | my $parentblock = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sort: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $sortsub = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $arr = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my @ret = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | foreach my $c (sort { $sortsub->($a,$b) } @$arr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | push(@ret, $parentblock, $c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | return \@ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | sub iterate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | my $parentblock = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iterate: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $arr = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | my $collapsearrayrefs = shift || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my @ret = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | foreach my $c (@$arr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | if (ref($c) eq "ARRAY" && $collapsearrayrefs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
ref $c eq "ARRAY" and $collapsearrayrefs
MC/DC0%0/2
ref $c eq "ARRAY" and $collapsearrayrefs
ref $c eq "ARRAY"
$collapsearrayrefs
Truth table0%0/3
A and B
A= ref $c eq "ARRAY"B= $collapsearrayrefs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | my $itr = iterate($parentblock, $c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | push(@ret, @{$itr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } elsif (defined $c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | push(@ret, $parentblock, $c); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | return \@ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | sub fetchraw { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | my $f = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetchraw: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # If we want an absolute path, use document root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | if ($f =~ /\//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $f = $ENV{DOCUMENT_ROOT}.$f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # And don't allow back-tracking through the file system! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $f =~ s|\/[\.\/]+|\/|; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $rawfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if (-e $f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | local($/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | open(RAWFILE, $f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $rawfile = <RAWFILE>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | close(RAWFILE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | return $rawfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | sub fetch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | my $f = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | our $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $fetch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | if ($f !~ /^[\.\/]/) { $f = "./".$f; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | if (-e $f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $fetch = do($f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | if (!$fetch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | carp "Do failed for $f at error: $@\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if ($!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | carp "Do failed for $f bang error: $!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if (ref $fetch eq "CODE") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $fetch = $fetch->($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my $pwd = `pwd`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | chomp($pwd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | carp "Couldn't find $f ($pwd)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | return $fetch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | sub display { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | my $f = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $ret = fetch($f, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | print gen($ret); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | sub push { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | my $arr = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my $f = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my $arg = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my $ret = fetch($f,$arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | push(@{$arr}, @{$ret}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | sub append { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | my $insertpoint = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my $inserto = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | if (!ref $inserto && $inserto =~ /staticfile:(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not ref $inserto and $inserto =~ /staticfile:(.*)/
MC/DC0%0/2
not ref $inserto and $inserto =~ /staticfile:(.*)/
not ref $inserto
$inserto =~ /staticfile:(.*)/
Truth table0%0/3
not(A) and B
A= not ref $insertoB= $inserto =~ /staticfile:(.*)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $inserto = HTML::Obj2HTML::fetchraw($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ▶ | } elsif (!ref $inserto && $inserto =~ /file:(.*)/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not ref $inserto and $inserto =~ /file:(.*)/
MC/DC0%0/2
not ref $inserto and $inserto =~ /file:(.*)/
not ref $inserto
$inserto =~ /file:(.*)/
Truth table0%0/3
not(A) and B
A= not ref $insertoB= $inserto =~ /file:(.*)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $inserto = fetch($1, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $o = find($storage, $insertpoint); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | foreach my $e (@{$o}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | # convert to common format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if (!ref $e->[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | $e->[1] = { _ => [ _ => $e->[1] ] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } elsif (ref $e->[1] eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $e->[1] = { _ => $e->[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | CORE::push(@{$e->[1]->{_}}, @{$inserto}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | sub prepend { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | my $insertpoint = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepend: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $inserto = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if (!ref $inserto && $inserto =~ /staticfile:(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not ref $inserto and $inserto =~ /staticfile:(.*)/
MC/DC0%0/2
not ref $inserto and $inserto =~ /staticfile:(.*)/
not ref $inserto
$inserto =~ /staticfile:(.*)/
Truth table0%0/3
not(A) and B
A= not ref $insertoB= $inserto =~ /staticfile:(.*)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | $inserto = HTML::Obj2HTML::fetchraw($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | ▶ | } elsif (!ref $inserto && $inserto =~ /file:(.*)/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not ref $inserto and $inserto =~ /file:(.*)/
MC/DC0%0/2
not ref $inserto and $inserto =~ /file:(.*)/
not ref $inserto
$inserto =~ /file:(.*)/
Truth table0%0/3
not(A) and B
A= not ref $insertoB= $inserto =~ /file:(.*)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $inserto = fetch($1, $args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | my $o = find($storage, $insertpoint); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | foreach my $e (@{$o}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # convert to common format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | if (!ref $e->[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $e->[1] = { _ => [ _ => $e->[1] ] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } elsif (ref $e->[1] eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $e->[1] = { _ => $e->[1] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | unshift(@{$e->[1]->{_}}, @{$inserto}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | sub find { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $query = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | my $ret = shift || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || []
MC/DC0%0/1
shift() || []
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my @tags = @{$o}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | while (@tags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my $tag = shift(@tags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | my $attr = shift(@tags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | if (ref $attr eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | find($attr, $query, $ret); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } elsif (ref $attr eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my %attrs = %{$attr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | my $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | if ($attrs{_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | find($attrs{_}, $query, $ret); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | if ($query =~ /\#(.*)/ && $attrs{id} eq $1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$query =~ /\#(.*)/ and $attrs{"id"} eq $1
MC/DC0%0/2
$query =~ /\#(.*)/ and $attrs{"id"} eq $1
$query =~ /\#(.*)/
$attrs{"id"} eq $1
Truth table0%0/3
A and B
A= $query =~ /\#(.*)/B= $attrs{"id"} eq $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | CORE::push(@{$ret}, [$tag, $attr]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | ▶ | } elsif ($query =~ /^([^\#\.]\S*)/ && $tag eq $1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$query =~ /^([^\#\.]\S*)/ and $tag eq $1
MC/DC0%0/2
$query =~ /^([^\#\.]\S*)/ and $tag eq $1
$query =~ /^([^\#\.]\S*)/
$tag eq $1
Truth table0%0/3
A and B
A= $query =~ /^([^\#\.]\S*)/B= $tag eq $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | CORE::push(@{$ret}, [$tag, $attr]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | sub gen { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 4 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen: called CC=120 SCAR=89.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 4 | my $ret = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 4 | ▶ | if (!defined $o) { return ""; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 4 | ▶ | if (!ref $o) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $o = web_escape($o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | return $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 4 | ▶ | if (ref $o eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | carp "HTML::Obj2HTML::gen called with a hash reference!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 4 | ▶ | if (ref $o eq "CODE") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $ret = HTML::Obj2HTML::gen($o->()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | if ($@) { carp "Error parsing HTML::Obj2HTML objects when calling code ref: $@\n"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 4 | ▶ | if (ref $o ne "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 4 | my @tags = @{$o}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 4 | ▶ | while (@tags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 6 | my $tag = shift(@tags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 6 | ▶ | if (!defined $tag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 6 | ▶ | if (ref $tag eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $ret .= HTML::Obj2HTML::gen($tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 6 | ▶ | if (ref $tag eq "CODE") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $ret .= HTML::Obj2HTML::gen($tag->()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if ($@) { carp "Error parsing HTML::Obj2HTML objects when calling code ref: $@\n"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 6 | ▶ | if ($tag =~ /_(.+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $ret .= HTML::Obj2HTML::gen(get_snippet($1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | # If the tag has a space it's not a valid tag, so output it as content instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 6 | ▶ | if ($tag =~ /\s/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $ret .= $tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 6 | my $attr = shift(@tags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 6 | ▶ | if ($html_fromarrayref_format) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # Make this module behave more like HTML::FromArrayref, where you have elementname, { attributes }, content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # This should be considered for backward compatibility; The find routine would struggle with this... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if (ref $attr eq "HASH" && ($tags{$tag} & END_TAG_FORBIDDEN) == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $attr eq "HASH" and ($tags{$tag} & 2) == 0
MC/DC0%0/2
ref $attr eq "HASH" and ($tags{$tag} & 2) == 0
ref $attr eq "HASH"
($tags{$tag} & 2) == 0
Truth table0%0/3
A and B
A= ref $attr eq "HASH"B= ($tags{$tag} & 2) == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $attr->{"_"} = shift(@tags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # Typically linking to another file will return an arrayref, but could equally return a hashref to also set the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | # attributes of the element calling it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 6 | ▶ | if ($attr && !ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$attr and not ref $attr
MC/DC50%1/2
$attr and not ref $attr
$attr
not ref $attr
Truth table66%2/3
A and not(B)
A= $attrB= not ref $attr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 3 | ▶ | if ($attr =~ /staticfile:(.+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $attr = HTML::Obj2HTML::fetchraw($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } elsif ($attr =~ /file:(.+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | $attr = HTML::Obj2HTML::fetch($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } elsif ($attr =~ /raw:(.+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $attr = HTML::Obj2HTML::fetchraw($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # Run the current tag through extentions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 6 | my $origtag = $tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 6 | ▶ | if (defined $extensions{$origtag}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | if (defined $extensions{$origtag}->{scalarattr} && !ref $attr) { $attr = { $extensions{$origtag}->{scalarattr} => $attr }; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $extensions{$origtag}{"scalarattr"} and not ref $attr
MC/DC0%0/2
defined $extensions{$origtag}{"scalarattr"} and not ref $attr
defined $extensions{$origtag}{"scalarattr"}
not ref $attr
Truth table0%0/3
A and not(B)
A= defined $extensions{$origtag}{"scalarattr"}B= not ref $attr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if (defined $extensions{$origtag}->{before}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my $o = $extensions{$origtag}->{before}($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | if (ref $o eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $ret .= HTML::Obj2HTML::gen($o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } elsif (ref $o eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $ret .= $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if (defined $extensions{$origtag}->{tag}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $tag = $extensions{$origtag}->{tag}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | if (defined $extensions{$origtag}->{attr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | if (ref $attr ne "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | $attr = { _ => $attr }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | foreach my $k (keys %{$extensions{$origtag}->{attr}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if (defined $attr->{$k}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $attr->{$k} = $extensions{$origtag}->{attr}->{$k}." ".$attr->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | ▶ | if ($k eq "class") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $attr->{$k} = join(" ", uniq(split(/\s+/, $attr->{$k}))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $attr->{$k} = $extensions{$origtag}->{attr}->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | if (defined $extensions{$origtag}->{replace}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my $o = HTML::Obj2HTML::gen($extensions{$origtag}->{replace}($attr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | if (ref $o eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $ret .= HTML::Obj2HTML::gen($o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } elsif (ref $o eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $ret .= $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | $tag = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | # Non-HTML functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 6 | ▶ | if ($tag eq "_") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 15 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | if (ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | carp("HTML::Obj2HTML: _ element called, but attr wasn't a scalar."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $ret .= web_escape($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } elsif ($tag eq "raw") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | if (ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | carp("HTML::Obj2HTML: raw element called, but attr wasn't a scalar."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | $ret .= "$attr"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } elsif ($tag eq "if") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | if (ref $attr eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | if ($attr->{cond} && $attr->{true}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$attr->{"cond"} and $attr->{"true"}
MC/DC0%0/2
$attr->{"cond"} and $attr->{"true"}
$attr->{"cond"}
$attr->{"true"}
Truth table0%0/3
A and B
A= $attr->{"cond"}B= $attr->{"true"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | $ret .= HTML::Obj2HTML::gen($attr->{true}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | ▶ | } elsif (!$attr->{cond} && $attr->{false}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $attr->{"cond"} and $attr->{"false"}
MC/DC0%0/2
not $attr->{"cond"} and $attr->{"false"}
not $attr->{"cond"}
$attr->{"false"}
Truth table0%0/3
not(A) and B
A= not $attr->{"cond"}B= $attr->{"false"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | $ret .= HTML::Obj2HTML::gen($attr->{false}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } elsif (ref $attr eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | ▶ | for (my $i = 0; $i<$#{$attr}; $i+=2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | if ($attr->[$i]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | $ret .= HTML::Obj2HTML::gen($attr->[$i+1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | carp("HTML::Obj2HTML: if element called, but attr wasn't a hash ref or array ref."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } elsif ($tag eq "switch") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | if (ref $attr eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | if (defined $attr->{$attr->{val}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $ret .= HTML::Obj2HTML::gen($attr->{$attr->{val}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } elsif (defined $attr->{"_default"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | $ret .= HTML::Obj2HTML::gen($attr->{"_default"}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } elsif (defined $attr->{"_"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | $ret .= HTML::Obj2HTML::gen($attr->{"_"}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | carp("HTML::Obj2HTML: switch element called, but attr wasn't a hash ref."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } elsif ($tag eq "md") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | if (ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | carp("HTML::Obj2HTML: md element called, but attr wasn't a scalar."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $ret .= markdown($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } elsif ($tag eq "plain") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | if (ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | carp("HTML::Obj2HTML: plain element called, but attr wasn't a scalar."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | $ret .= plain($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } elsif ($tag eq "currency") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | if (ref $attr eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | $ret .= web_escape(currency_format($attr->{currency} || $default_currency, $attr->{"_"}, FMT_SYMBOL)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$attr->{'currency'} || $default_currency
MC/DC0%0/2
$attr->{'currency'} || $default_currency
$attr->{'currency'}
$default_currency
Truth table0%0/3
A || B
A= $attr->{'currency'}B= $default_currency
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } elsif (!ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | $ret .= web_escape(currency_format($default_currency, $attr, FMT_SYMBOL)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | carp("HTML::Obj2HTML: currency called, but attr wasn't a hash ref or plain scalar."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } elsif ($tag eq "pluralize") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | if (ref $attr eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | $ret .= pluralize($attr->[0], $attr->[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | carp("HTML::Obj2HTML: pluralize called, but attr wasn't a array ref"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } elsif ($tag eq "include") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $ret .= HTML::Obj2HTML::gen(HTML::Obj2HTML::fetch($o->{src}.$file_ext, $attr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } elsif ($tag eq "javascript") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $ret .= "<script language='javascript' type='text/javascript' defer='1'><!--\n$attr\n//--></script>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } elsif ($tag eq "includejs") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | ▶ | if (!ref $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $ret .= "<script language='javascript' type='text/javascript' defer='1' async='1' src='$attr'></script>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } elsif (ref $attr == "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | $ret .= "<script language='javascript' type='text/javascript' "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if ($attr->{defer}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | $ret .= "defer='1' "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | if ($attr->{async}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | $ret .= "async='1' "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | $ret .= "src='$attr->{src}'></script>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } elsif ($tag eq "includecss") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $ret .= "<link rel='stylesheet' type='text/css' href='$attr' />"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } elsif ($tag eq "doctype") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 1 | $ret .= "<!DOCTYPE $attr>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | ▶ | } elsif (ref $attr eq "HASH" && defined $attr->{removeif} && $attr->{removeif}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
ref $attr eq "HASH" and defined $attr->{"removeif"} and $attr->{"removeif"}
ref $attr eq "HASH" and defined $attr->{"removeif"}
MC/DC0%0/3
ref $attr eq "HASH" and defined $attr->{"removeif"} and $attr->{"removeif"}
ref $attr eq "HASH"
defined $attr->{"removeif"}
$attr->{"removeif"}
Truth table25%1/4
A and B and C
A= ref $attr eq "HASH"B= defined $attr->{"removeif"}C= $attr->{"removeif"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | $ret .= HTML::Obj2HTML::gen($attr->{_}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | # Finally through all the non-HTML elements ;) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } elsif ($tag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | # It's perfectly allowed to omit content from a tag where the end tag was forbidden | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | # If we have content, we have to assume that it should appear after the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | # tag - not discard it, or show it within | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | # If we've got a hash ref though, we have attributes :) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | # Note that this has to go here, because the attribute might have been a staticfile: or similar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | # to execute some additional code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 5 | ▶ | if ($tags{$tag} & END_TAG_FORBIDDEN && ref $attr ne "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tags{$tag} & 2 and ref $attr ne "HASH"
MC/DC0%0/2
$tags{$tag} & 2 and ref $attr ne "HASH"
$tags{$tag} & 2
ref $attr ne "HASH"
Truth table33%1/3
A and B
A= $tags{$tag} & 2B= ref $attr ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | unshift(@tags, $attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | $attr = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 5 | ▶ | if ($warn_on_unknown_tag && !defined $tags{$tag}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$warn_on_unknown_tag and not defined $tags{$tag}
MC/DC0%0/2
$warn_on_unknown_tag and not defined $tags{$tag}
$warn_on_unknown_tag
not defined $tags{$tag}
Truth table33%1/3
A and not(B)
A= $warn_on_unknown_tagB= not defined $tags{$tag}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | carp "Warning: Unknown tag $tag in HTML::Obj2HTML\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 5 | $ret .= "<$tag"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 5 | ▶ | if (!defined $attr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | if ($tags{$tag} & END_TAG_FORBIDDEN) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | if ($mode eq "XHTML") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $ret .= " />"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | $ret .= ">"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } elsif ($tags{$tag} & END_TAG_REQUIRED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | $ret .= "></$tag>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | } elsif (ref $attr eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 3 | $ret .= ">"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 3 | $ret .= HTML::Obj2HTML::gen($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 3 | $ret .= "</$tag>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } elsif (ref $attr eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | my %attrs = %{$attr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | my $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | foreach my $k (keys(%attrs)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | ▶ | if (ref $k eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | $content = $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } elsif (ref $attrs{$k} eq "ARRAY") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | # shorthand, you can defined the content within the classname, e.g. div => { "ui segment" => [ _ => "Content" ] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | if ($k ne "_") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $ret .= format_attr("class", $k); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | ▶ | $content = $attrs{$k} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$attrs{$k} || ''
MC/DC0%0/1
$attrs{$k} || ''
$attrs{$k}
Truth table0%0/2
A
A= $attrs{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | } elsif (ref $attrs{$k} eq "HASH") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | if ($k eq "style") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | my @styles = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | while (my ($csskey, $cssval) = each(%{$attrs{$k}})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | CORE::push(@styles, $csskey.":".$cssval.";"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | $ret .= format_attr("style", join("",@styles)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } elsif ($k eq "if") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | my $val = $attrs{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | if ($val->{cond} && $val->{true}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$val->{"cond"} and $val->{"true"}
MC/DC0%0/2
$val->{"cond"} and $val->{"true"}
$val->{"cond"}
$val->{"true"}
Truth table0%0/3
A and B
A= $val->{"cond"}B= $val->{"true"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | foreach my $newk (keys(%{$val->{true}})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | $ret .= format_attr($newk, $val->{true}->{$newk}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | ▶ | } elsif (!$val->{cond} && $val->{false}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $val->{"cond"} and $val->{"false"}
MC/DC0%0/2
not $val->{"cond"} and $val->{"false"}
not $val->{"cond"}
$val->{"false"}
Truth table0%0/3
not(A) and B
A= not $val->{"cond"}B= $val->{"false"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | foreach my $newk (keys(%{$val->{false}})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $ret .= format_attr($newk, $val->{false}->{$newk}) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } elsif (defined $attrs{$k}->{if}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | ▶ | if ($attrs{$k}->{if} && defined $attrs{$k}->{true}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$attrs{$k}{"if"} and defined $attrs{$k}{"true"}
MC/DC0%0/2
$attrs{$k}{"if"} and defined $attrs{$k}{"true"}
$attrs{$k}{"if"}
defined $attrs{$k}{"true"}
Truth table0%0/3
A and B
A= $attrs{$k}{"if"}B= defined $attrs{$k}{"true"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | $ret .= format_attr($k, $attrs{$k}->{true}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | ▶ | } elsif (!$attrs{$k}->{if} && defined $attrs{$k}->{false}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not $attrs{$k}{"if"} and defined $attrs{$k}{"false"}
MC/DC0%0/2
not $attrs{$k}{"if"} and defined $attrs{$k}{"false"}
not $attrs{$k}{"if"}
defined $attrs{$k}{"false"}
Truth table0%0/3
not(A) and B
A= not $attrs{$k}{"if"}B= defined $attrs{$k}{"false"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | $ret .= format_attr($k, $attrs{$k}->{false}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } elsif ($k eq "_") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | $content = $attrs{$k} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$attrs{$k} || ''
MC/DC0%0/1
$attrs{$k} || ''
$attrs{$k}
Truth table0%0/2
A
A= $attrs{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | $ret .= format_attr($k, $attrs{$k}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | if ($tags{$tag} & END_TAG_FORBIDDEN) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | # content is also forbidden! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | ▶ | if ($mode eq "XHTML") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | $ret .= " />"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | $ret .= ">"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } elsif (defined $content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | $ret .= ">"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | $ret .= HTML::Obj2HTML::gen($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | $ret .= "</$tag>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } elsif ($tags{$tag} & END_TAG_REQUIRED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | $ret .= "></$tag>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | if ($mode eq "XHTML") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | $ret .= " />"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | $ret .= ">"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | } elsif (ref $attr eq "CODE") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | $ret .= ">"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | $ret .= gen($attr->()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | $ret .= "</$tag>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | if ($@) { warn "Error parsing HTML::Obj2HTML objects when calling code ref: $@\n"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } elsif (ref $attr eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 2 | my $val = web_escape($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 2 | $ret .= ">$val</$tag>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 6 | ▶ | if (defined $extensions{$origtag} && defined $extensions{$origtag}->{after}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $extensions{$origtag} and defined $extensions{$origtag}{"after"}
MC/DC0%0/2
defined $extensions{$origtag} and defined $extensions{$origtag}{"after"}
defined $extensions{$origtag}
defined $extensions{$origtag}{"after"}
Truth table33%1/3
A and B
A= defined $extensions{$origtag}B= defined $extensions{$origtag}{"after"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $ret .= $extensions{$origtag}->{after}($attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 4 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | sub format_attr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | my $k = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_attr: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | $val = web_escape($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | if (defined $val) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | return " $k=\"$val\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | sub substitute_dictionary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 2 | ▶ | my $val = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
substitute_dictionary: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 2 | ▶ | if ($val) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 2 | $val =~ s/%([A-Za-z0-9]+)%/$dictionary{$1}/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 2 | return $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | sub web_escape { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 2 | ▶ | my $val = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
web_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 2 | $val = HTML::Entities::encode($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 2 | $val = substitute_dictionary($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 2 | return $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | sub plain { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | my $txt = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plain: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $txt = web_escape($txt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | $txt =~ s|\n|<br />|g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | return $txt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | sub markdown { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | ▶ | my $txt = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
markdown: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | $txt = substitute_dictionary($txt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | my $m = new Text::Markdown; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | my $val = $m->markdown(HTML::Entities::encode($txt)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | return $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | sub print { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | ▶ | my $o = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | print gen($o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | sub format { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | ▶ | my $plain = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | $plain =~ s/\n/<br \/>/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | return [ raw => $plain ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | sub register_extension { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 39 | ▶ | my $tag = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_extension: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 39 | my $def = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 39 | my $flags = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 39 | $extensions{$tag} = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 39 | ▶ | if (defined $flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | $tags{$tag} = $flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 39 | $tags{$tag} = END_TAG_OPTIONAL; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||