| 1 | package HTML::Declare; | ||||||||||||||
| 2 | 2 | $HTML::Declare::VERSION = '2.6'; | |||||||||||||
| 3 | #ABSTRACT: For When Template Systems Are Too Huge And Heredocs Too Messy | ||||||||||||||
| 4 | |||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 2 | ▶ | use base 'Exporter'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 2 | ▶ | use HTML::Entities 'encode_entities'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | 2 | ▶ | use overload '""' => sub { shift->as_html }; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | 10 | ▶ | sub TAG (@) { | ||||||||||||
|
Subroutine
TAG: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||
| 13 | 10 | my $attributes = shift; | |||||||||||||
| 14 | |||||||||||||||
| 15 | 10 | my $sub = ( caller(1) )[3]; | |||||||||||||
| 16 | 10 | $sub =~ /.*::(.*)$/; | |||||||||||||
| 17 | 10 | my $tag = lc $1; | |||||||||||||
| 18 | |||||||||||||||
| 19 | 10 | my $html = HTML::Declare->new; | |||||||||||||
| 20 | 10 | $html->tag($tag); | |||||||||||||
| 21 | |||||||||||||||
| 22 | 10 | ▶ | $attributes ||= {}; | ||||||||||||
|
Condition50%1/2
$attributes ||= {}
MC/DC0%0/1
$attributes ||= {}
$attributes
Truth table50%1/2
A
A= $attributes
| |||||||||||||||
| 23 | 10 | my $children = []; | |||||||||||||
| 24 | |||||||||||||||
| 25 | 10 | for my $key ( keys %$attributes ) { | |||||||||||||
| 26 | |||||||||||||||
| 27 | 11 | my $value = $attributes->{$key}; | |||||||||||||
| 28 | |||||||||||||||
| 29 | 11 | ▶ | if ( $key eq '_' ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 30 | |||||||||||||||
| 31 | 10 | ▶ | if ( ref $value eq 'ARRAY' ) { $children = $value } | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 32 | 1 | elsif ( ref $value eq 'HTML::Declare' ) { $children = [$value] } | |||||||||||||
| 33 | 5 | else { $children = [ encode_entities("$value") ] } | |||||||||||||
| 34 | |||||||||||||||
| 35 | } | ||||||||||||||
| 36 | 1 | else { push @{ $html->attributes }, [ $key, $value ] } | |||||||||||||
| 37 | } | ||||||||||||||
| 38 | |||||||||||||||
| 39 | 10 | $html->children($children); | |||||||||||||
| 40 | |||||||||||||||
| 41 | 10 | return $html; | |||||||||||||
| 42 | } | ||||||||||||||
| 43 | |||||||||||||||
| 44 | 2 | our @EXPORT_OK = qw/ | |||||||||||||
| 45 | A | ||||||||||||||
| 46 | ABBR | ||||||||||||||
| 47 | ACRONYM | ||||||||||||||
| 48 | ADDRESS | ||||||||||||||
| 49 | AREA | ||||||||||||||
| 50 | B | ||||||||||||||
| 51 | BASE | ||||||||||||||
| 52 | BDO | ||||||||||||||
| 53 | BIG | ||||||||||||||
| 54 | BLOCKQUOTE | ||||||||||||||
| 55 | BODY | ||||||||||||||
| 56 | BR | ||||||||||||||
| 57 | BUTTON | ||||||||||||||
| 58 | CAPTION | ||||||||||||||
| 59 | CITE | ||||||||||||||
| 60 | CODE | ||||||||||||||
| 61 | COL | ||||||||||||||
| 62 | COLGROUP | ||||||||||||||
| 63 | DD | ||||||||||||||
| 64 | DEL | ||||||||||||||
| 65 | DIV | ||||||||||||||
| 66 | DFN | ||||||||||||||
| 67 | DL | ||||||||||||||
| 68 | DT | ||||||||||||||
| 69 | EM | ||||||||||||||
| 70 | FIELDSET | ||||||||||||||
| 71 | FORM | ||||||||||||||
| 72 | FRAME | ||||||||||||||
| 73 | FRAMESET | ||||||||||||||
| 74 | H1 | ||||||||||||||
| 75 | H2 | ||||||||||||||
| 76 | H3 | ||||||||||||||
| 77 | H4 | ||||||||||||||
| 78 | H5 | ||||||||||||||
| 79 | H6 | ||||||||||||||
| 80 | HEAD | ||||||||||||||
| 81 | HR | ||||||||||||||
| 82 | HTML | ||||||||||||||
| 83 | I | ||||||||||||||
| 84 | IFRAME | ||||||||||||||
| 85 | IMG | ||||||||||||||
| 86 | INPUT | ||||||||||||||
| 87 | INS | ||||||||||||||
| 88 | KBD | ||||||||||||||
| 89 | LABEL | ||||||||||||||
| 90 | LEGEND | ||||||||||||||
| 91 | LI | ||||||||||||||
| 92 | LINK | ||||||||||||||
| 93 | MAP | ||||||||||||||
| 94 | META | ||||||||||||||
| 95 | NOFRAMES | ||||||||||||||
| 96 | NOSCRIPT | ||||||||||||||
| 97 | OBJECT | ||||||||||||||
| 98 | OL | ||||||||||||||
| 99 | OPTGROUP | ||||||||||||||
| 100 | OPTION | ||||||||||||||
| 101 | P | ||||||||||||||
| 102 | PARAM | ||||||||||||||
| 103 | PRE | ||||||||||||||
| 104 | Q | ||||||||||||||
| 105 | SAMP | ||||||||||||||
| 106 | SCRIPT | ||||||||||||||
| 107 | SELECT | ||||||||||||||
| 108 | SMALL | ||||||||||||||
| 109 | SPAN | ||||||||||||||
| 110 | STRONG | ||||||||||||||
| 111 | STYLE | ||||||||||||||
| 112 | SUB | ||||||||||||||
| 113 | SUP | ||||||||||||||
| 114 | TABLE | ||||||||||||||
| 115 | TAG | ||||||||||||||
| 116 | TBODY | ||||||||||||||
| 117 | TD | ||||||||||||||
| 118 | TEXTAREA | ||||||||||||||
| 119 | TFOOT | ||||||||||||||
| 120 | TH | ||||||||||||||
| 121 | THEAD | ||||||||||||||
| 122 | TITLE | ||||||||||||||
| 123 | TR | ||||||||||||||
| 124 | TT | ||||||||||||||
| 125 | UL | ||||||||||||||
| 126 | VAR | ||||||||||||||
| 127 | /; | ||||||||||||||
| 128 | 2 | our %EXPORT_TAGS = ( all => \@EXPORT_OK ); | |||||||||||||
| 129 | |||||||||||||||
| 130 | 1 | ▶ | sub A ($) { TAG @_ } | ||||||||||||
|
Subroutine
A: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 131 | 0 | ▶ | sub ABBR ($) { TAG @_ } | ||||||||||||
|
Subroutine
ABBR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 132 | 0 | ▶ | sub ACRONYM ($) { TAG @_ } | ||||||||||||
|
Subroutine
ACRONYM: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 133 | 0 | ▶ | sub ADDRESS ($) { TAG @_ } | ||||||||||||
|
Subroutine
ADDRESS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 134 | 0 | ▶ | sub AREA ($) { TAG @_ } | ||||||||||||
|
Subroutine
AREA: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 135 | 0 | ▶ | sub B ($) { TAG @_ } | ||||||||||||
|
Subroutine
B: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 136 | 0 | ▶ | sub BASE ($) { TAG @_ } | ||||||||||||
|
Subroutine
BASE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 137 | 0 | ▶ | sub BDO ($) { TAG @_ } | ||||||||||||
|
Subroutine
BDO: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 138 | 0 | ▶ | sub BIG ($) { TAG @_ } | ||||||||||||
|
Subroutine
BIG: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 139 | 0 | ▶ | sub BLOCKQUOTE ($) { TAG @_ } | ||||||||||||
|
Subroutine
BLOCKQUOTE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 140 | 2 | ▶ | sub BODY ($) { TAG @_ } | ||||||||||||
|
Subroutine
BODY: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 141 | 0 | ▶ | sub BR ($) { TAG @_ } | ||||||||||||
|
Subroutine
BR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 142 | 0 | ▶ | sub BUTTON ($) { TAG @_ } | ||||||||||||
|
Subroutine
BUTTON: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 143 | 0 | ▶ | sub CAPTION ($) { TAG @_ } | ||||||||||||
|
Subroutine
CAPTION: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 144 | 0 | ▶ | sub CITE ($) { TAG @_ } | ||||||||||||
|
Subroutine
CITE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 145 | 0 | ▶ | sub CODE ($) { TAG @_ } | ||||||||||||
|
Subroutine
CODE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 146 | 0 | ▶ | sub COL ($) { TAG @_ } | ||||||||||||
|
Subroutine
COL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 147 | 0 | ▶ | sub COLGROUP ($) { TAG @_ } | ||||||||||||
|
Subroutine
COLGROUP: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 148 | 0 | ▶ | sub DD ($) { TAG @_ } | ||||||||||||
|
Subroutine
DD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 149 | 0 | ▶ | sub DEL ($) { TAG @_ } | ||||||||||||
|
Subroutine
DEL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 150 | 1 | ▶ | sub DIV ($) { TAG @_ } | ||||||||||||
|
Subroutine
DIV: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 151 | 0 | ▶ | sub DFN ($) { TAG @_ } | ||||||||||||
|
Subroutine
DFN: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 152 | 0 | ▶ | sub DL ($) { TAG @_ } | ||||||||||||
|
Subroutine
DL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 153 | 0 | ▶ | sub DT ($) { TAG @_ } | ||||||||||||
|
Subroutine
DT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 154 | 0 | ▶ | sub EM ($) { TAG @_ } | ||||||||||||
|
Subroutine
EM: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 155 | 0 | ▶ | sub FIELDSET ($) { TAG @_ } | ||||||||||||
|
Subroutine
FIELDSET: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 156 | 0 | ▶ | sub FORM ($) { TAG @_ } | ||||||||||||
|
Subroutine
FORM: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 157 | 0 | ▶ | sub FRAME ($) { TAG @_ } | ||||||||||||
|
Subroutine
FRAME: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 158 | 0 | ▶ | sub FRAMESET ($) { TAG @_ } | ||||||||||||
|
Subroutine
FRAMESET: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 159 | 0 | ▶ | sub H1 ($) { TAG @_ } | ||||||||||||
|
Subroutine
H1: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 160 | 0 | ▶ | sub H2 ($) { TAG @_ } | ||||||||||||
|
Subroutine
H2: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 161 | 0 | ▶ | sub H3 ($) { TAG @_ } | ||||||||||||
|
Subroutine
H3: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 162 | 0 | ▶ | sub H4 ($) { TAG @_ } | ||||||||||||
|
Subroutine
H4: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 163 | 0 | ▶ | sub H5 ($) { TAG @_ } | ||||||||||||
|
Subroutine
H5: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 164 | 0 | ▶ | sub H6 ($) { TAG @_ } | ||||||||||||
|
Subroutine
H6: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 165 | 2 | ▶ | sub HEAD ($) { TAG @_ } | ||||||||||||
|
Subroutine
HEAD: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 166 | 0 | ▶ | sub HR ($) { TAG @_ } | ||||||||||||
|
Subroutine
HR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 167 | 2 | ▶ | sub HTML ($) { TAG @_ } | ||||||||||||
|
Subroutine
HTML: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 168 | 0 | ▶ | sub I ($) { TAG @_ } | ||||||||||||
|
Subroutine
I: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 169 | 0 | ▶ | sub IFRAME ($) { TAG @_ } | ||||||||||||
|
Subroutine
IFRAME: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 170 | 0 | ▶ | sub IMG ($) { TAG @_ } | ||||||||||||
|
Subroutine
IMG: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 171 | 0 | ▶ | sub INPUT ($) { TAG @_ } | ||||||||||||
|
Subroutine
INPUT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 172 | 0 | ▶ | sub INS ($) { TAG @_ } | ||||||||||||
|
Subroutine
INS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 173 | 0 | ▶ | sub KBD ($) { TAG @_ } | ||||||||||||
|
Subroutine
KBD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 174 | 0 | ▶ | sub LABEL ($) { TAG @_ } | ||||||||||||
|
Subroutine
LABEL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 175 | 0 | ▶ | sub LEGEND ($) { TAG @_ } | ||||||||||||
|
Subroutine
LEGEND: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 176 | 0 | ▶ | sub LI ($) { TAG @_ } | ||||||||||||
|
Subroutine
LI: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 177 | 0 | ▶ | sub LINK ($) { TAG @_ } | ||||||||||||
|
Subroutine
LINK: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 178 | 0 | ▶ | sub MAP ($) { TAG @_ } | ||||||||||||
|
Subroutine
MAP: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 179 | 0 | ▶ | sub META ($) { TAG @_ } | ||||||||||||
|
Subroutine
META: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 180 | 0 | ▶ | sub NOFRAMES ($) { TAG @_ } | ||||||||||||
|
Subroutine
NOFRAMES: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 181 | 0 | ▶ | sub NOSCRIPT ($) { TAG @_ } | ||||||||||||
|
Subroutine
NOSCRIPT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 182 | 0 | ▶ | sub OBJECT ($) { TAG @_ } | ||||||||||||
|
Subroutine
OBJECT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 183 | 0 | ▶ | sub OL ($) { TAG @_ } | ||||||||||||
|
Subroutine
OL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 184 | 0 | ▶ | sub OPTGROUP ($) { TAG @_ } | ||||||||||||
|
Subroutine
OPTGROUP: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 185 | 0 | ▶ | sub OPTION ($) { TAG @_ } | ||||||||||||
|
Subroutine
OPTION: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 186 | 0 | ▶ | sub P ($) { TAG @_ } | ||||||||||||
|
Subroutine
P: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 187 | 0 | ▶ | sub PARAM ($) { TAG @_ } | ||||||||||||
|
Subroutine
PARAM: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 188 | 0 | ▶ | sub PRE ($) { TAG @_ } | ||||||||||||
|
Subroutine
PRE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 189 | 0 | ▶ | sub Q ($) { TAG @_ } | ||||||||||||
|
Subroutine
Q: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 190 | 0 | ▶ | sub SAMP ($) { TAG @_ } | ||||||||||||
|
Subroutine
SAMP: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 191 | 0 | ▶ | sub SCRIPT ($) { TAG @_ } | ||||||||||||
|
Subroutine
SCRIPT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 192 | 0 | ▶ | sub SELECT ($) { TAG @_ } | ||||||||||||
|
Subroutine
SELECT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 193 | 0 | ▶ | sub SMALL ($) { TAG @_ } | ||||||||||||
|
Subroutine
SMALL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 194 | 0 | ▶ | sub SPAN ($) { TAG @_ } | ||||||||||||
|
Subroutine
SPAN: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 195 | 0 | ▶ | sub STRONG ($) { TAG @_ } | ||||||||||||
|
Subroutine
STRONG: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 196 | 0 | ▶ | sub STYLE ($) { TAG @_ } | ||||||||||||
|
Subroutine
STYLE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 197 | 0 | ▶ | sub SUB ($) { TAG @_ } | ||||||||||||
|
Subroutine
SUB: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 198 | 0 | ▶ | sub SUP ($) { TAG @_ } | ||||||||||||
|
Subroutine
SUP: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 199 | 0 | ▶ | sub TABLE ($) { TAG @_ } | ||||||||||||
|
Subroutine
TABLE: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 200 | 0 | ▶ | sub TBODY ($) { TAG @_ } | ||||||||||||
|
Subroutine
TBODY: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 201 | 0 | ▶ | sub TD ($) { TAG @_ } | ||||||||||||
|
Subroutine
TD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 202 | 0 | ▶ | sub TEXTAREA ($) { TAG @_ } | ||||||||||||
|
Subroutine
TEXTAREA: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 203 | 0 | ▶ | sub TFOOT ($) { TAG @_ } | ||||||||||||
|
Subroutine
TFOOT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 204 | 0 | ▶ | sub TH ($) { TAG @_ } | ||||||||||||
|
Subroutine
TH: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 205 | 0 | ▶ | sub THEAD ($) { TAG @_ } | ||||||||||||
|
Subroutine
THEAD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 206 | 2 | ▶ | sub TITLE ($) { TAG @_ } | ||||||||||||
|
Subroutine
TITLE: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 207 | 0 | ▶ | sub TR ($) { TAG @_ } | ||||||||||||
|
Subroutine
TR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 208 | 0 | ▶ | sub TT ($) { TAG @_ } | ||||||||||||
|
Subroutine
TT: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 209 | 0 | ▶ | sub UL ($) { TAG @_ } | ||||||||||||
|
Subroutine
UL: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 210 | 0 | ▶ | sub VAR ($) { TAG @_ } | ||||||||||||
|
Subroutine
VAR: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 211 | |||||||||||||||
| 212 | 10 | ▶ | sub new { return bless {}, shift } | ||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||
| 213 | |||||||||||||||
| 214 | 10 | ▶ | sub as_html { | ||||||||||||
|
Subroutine
as_html: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||
| 215 | 10 | my $self = shift; | |||||||||||||
| 216 | |||||||||||||||
| 217 | 10 | my $tag = $self->tag; | |||||||||||||
| 218 | 10 | my $html = "<$tag"; | |||||||||||||
| 219 | |||||||||||||||
| 220 | 10 | for my $attribute ( @{ $self->attributes } ) { | |||||||||||||
| 221 | 1 | my $key = $attribute->[0]; | |||||||||||||
| 222 | 1 | my $value = $attribute->[1]; | |||||||||||||
| 223 | 1 | $html .= qq/ $key="$value"/; | |||||||||||||
| 224 | } | ||||||||||||||
| 225 | |||||||||||||||
| 226 | 10 | ▶ | if ( @{ $self->children } ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 227 | |||||||||||||||
| 228 | 10 | $html .= '>'; | |||||||||||||
| 229 | 10 | for my $child ( @{ $self->children } ) { | |||||||||||||
| 230 | 12 | $html .= "$child"; | |||||||||||||
| 231 | } | ||||||||||||||
| 232 | 10 | $html .= "</$tag>"; | |||||||||||||
| 233 | |||||||||||||||
| 234 | } | ||||||||||||||
| 235 | 0 | else { $html .= '/>' } | |||||||||||||
| 236 | |||||||||||||||
| 237 | 10 | return $html; | |||||||||||||
| 238 | } | ||||||||||||||
| 239 | |||||||||||||||
| 240 | 11 | ▶ | sub attributes { | ||||||||||||
|
Subroutine
attributes: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||
| 241 | 11 | my ( $self, $attributes ) = @_; | |||||||||||||
| 242 | 11 | ▶ | $self->{attributes} ||= []; | ||||||||||||
|
Condition100%2/2
$self->{"attributes"} ||= []
MC/DC100%1/1
$self->{"attributes"} ||= []
$self->{"attributes"}
Truth table100%2/2
A
A= $self->{"attributes"}
| |||||||||||||||
| 243 | 11 | ▶ | return $self->{attributes} unless $attributes; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 244 | 0 | return $self->{attributes} = $attributes; | |||||||||||||
| 245 | } | ||||||||||||||
| 246 | |||||||||||||||
| 247 | 30 | ▶ | sub children { | ||||||||||||
|
Subroutine
children: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||
| 248 | 30 | my ( $self, $children ) = @_; | |||||||||||||
| 249 | 30 | ▶ | $self->{children} ||= []; | ||||||||||||
|
Condition100%2/2
$self->{"children"} ||= []
MC/DC100%1/1
$self->{"children"} ||= []
$self->{"children"}
Truth table100%2/2
A
A= $self->{"children"}
| |||||||||||||||
| 250 | 30 | ▶ | return $self->{children} unless $children; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 251 | 10 | return $self->{children} = $children; | |||||||||||||
| 252 | } | ||||||||||||||
| 253 | |||||||||||||||
| 254 | 20 | ▶ | sub tag { | ||||||||||||
|
Subroutine
tag: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||
| 255 | 20 | my ( $self, $tag ) = @_; | |||||||||||||
| 256 | 20 | ▶ | $self->{tag} ||= ''; | ||||||||||||
|
Condition100%2/2
$self->{"tag"} ||= ""
MC/DC100%1/1
$self->{"tag"} ||= ""
$self->{"tag"}
Truth table100%2/2
A
A= $self->{"tag"}
| |||||||||||||||
| 257 | 20 | ▶ | return $self->{tag} unless $tag; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 258 | 10 | return $self->{tag} = $tag; | |||||||||||||
| 259 | } | ||||||||||||||
| 260 | |||||||||||||||
| 261 | 2 | 1; | |||||||||||||
| 262 | |||||||||||||||
| 263 | __END__ | ||||||||||||||