| 1 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # This file is part of WebDyne. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Full license text is available at: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # <http://dev.perl.org/licenses/> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | package WebDyne::HTML::TreeBuilder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Compiler Pragma | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use strict qw(vars); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use vars qw($VERSION @ISA %CGI_TAG_WEBDYNE %CGI_TAG_FORM %CGI_TAG_IMPLICIT %CGI_TAG_SPECIAL); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | no warnings qw(uninitialized redefine once); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # WebDyne Modules | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use WebDyne; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use WebDyne::Constant; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use WebDyne::HTML::Tiny; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use WebDyne::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # External Modules. Keep HTML::Entities or nullification of encode/decode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # subs will not work below | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | use HTML::TreeBuilder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | use HTML::Entities; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | use HTML::Tagset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use IO::File; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | use Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # Inheritance | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | @ISA=qw(HTML::TreeBuilder); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # Version information | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | $VERSION='3.029'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # Debug load | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | debug("Loading %s version $VERSION", __PACKAGE__); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # Form based tags we don't want to compile as their value may change if keeping state | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | %CGI_TAG_FORM=map {$_ => 1} (qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | textfield | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | textarea | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | password_field | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | checkbox | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | checkbox_group | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | radio_group | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | popup_menu | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | scrolling_list | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # Make a hash of our implictly closed tags. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | %CGI_TAG_IMPLICIT=map {$_ => 1} (keys(%CGI_TAG_FORM), qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | filefield | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | hidden | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | submit | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | defaults | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | image_button | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | isindex | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | dump | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | include | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | json | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | )); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | # Update - get from CGI module, add special dump tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | #%CGI_TAG_IMPLICIT=map {$_ => 1} ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # @{$CGI::EXPORT_TAGS{':form'}}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # 'dump' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | #D# | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | #); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | #delete @CGI_TAG_IMPLICIT{qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # button | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | #)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # Get WebDyne tags from main module | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | %CGI_TAG_WEBDYNE=%WebDyne::CGI_TAG_WEBDYNE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # The tags below need to be handled specially at compile time - see the method | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # associated with each tag below. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | #map {$CGI_TAG_SPECIAL{$_}++} qw(perl script style start_html end_html include); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | map {$CGI_TAG_SPECIAL{$_}++} qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | perl | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | style | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | start_html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | end_html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | start_form | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | end_form | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | start_multipart_form | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | end_multipart_form | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | include | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | div | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | api | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | json | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | htmx | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | table | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # Nullify Entities encode & decode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | ▶ | *HTML::Entities::encode=sub { }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | *HTML::Entities::decode=sub { }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # Add to islist items in TreeBuilder | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | map {$HTML::Tagset::isList{$_}++} keys %CGI_TAG_WEBDYNE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # Need to tell HTML::TagSet about our special elements. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # Update - used to do this but now done in table() method below | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | #map {$HTML::Tagset::isTableElement{$_}++} keys %CGI_TAG_WEBDYNE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # Add to valid body elements - means Treebuilder will automatically | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # create html,head,body sections and include this - for truly lazy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # that just create a .psp file with no leading start_html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | map { $HTML::Tagset::isBodyElement{$_}++ } qw(htmx json dump); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # And that we also block <p> tag closures | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | push @HTML::Tagset::p_closure_barriers, keys %CGI_TAG_WEBDYNE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # All done. Positive return | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | #================================================================================================== | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 3 | ▶ | sub new { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=20.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | # Instantiate new WebDyne::HTML::TreeBuilder object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 3 | my ($class, %param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 3 | ▶ | debug('in %s new(), class: %s, param: %s', __PACKAGE__, (ref($class) || $class), Dumper(\%param)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 3 | ▶ | my $self=$class->SUPER::new(%param) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition20%1/5
$class->SUPER::new(%param) || (return err('unable to initialize from %s, using ISA: %s', ref $class || $class, Dumper(\@WebDyne::HTML::TreeBuilder::ISA)))
ref $class || $class
MC/DC0%0/1
$class->SUPER::new(%param) || (return err('unable to initialize from %s, using ISA: %s', ref $class || $class, Dumper(\@WebDyne::HTML::TreeBuilder::ISA)))
$class->SUPER::new(%param)
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table50%1/2
A
A= $class->SUPER::new(%param)
Truth table0%0/3
A || B
A= ref $classB= $class
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | return err('unable to initialize from %s, using ISA: %s', ref($class) || $class, Dumper(\@ISA)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # We do need a HTML::Tiny object that has been ideally already been instantiated. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $self->{'_html_tiny_or'}=($param{'html_tiny_or'} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | ▶ | WebDyne::HTML::Tiny->new(mode => $WEBDYNE_HTML_TINY_MODE, r=>$param{'r'})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$param{'html_tiny_or'} || 'WebDyne::HTML::Tiny'->new('mode', $WebDyne::HTML::TreeBuilder::WEBDYNE_HTML_TINY_MODE, 'r', $param{'r'})
MC/DC0%0/2
$param{'html_tiny_or'} || 'WebDyne::HTML::Tiny'->new('mode', $WebDyne::HTML::TreeBuilder::WEBDYNE_HTML_TINY_MODE, 'r', $param{'r'})
$param{'html_tiny_or'}
'WebDyne::HTML::Tiny'->new('mode', $WebDyne::HTML::TreeBuilder::WEBDYNE_HTML_TINY_MODE, 'r', $param{'r'})
Truth table33%1/3
A || B
A= $param{'html_tiny_or'}B= 'WebDyne::HTML::Tiny'->new('mode', $WebDyne::HTML::TreeBuilder::WEBDYNE_HTML_TINY_MODE, 'r', $param{'r'})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # Done | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 3 | return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 18 | ▶ | sub line_no_debug { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
line_no_debug: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 18 | my $self=shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 18 | return sprintf("self $self, line_no: %s, line_no_start: %s, line_no_next: %s", @{$self}{qw(_line_no _line_no_start _line_no_next)}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 3 | ▶ | sub parse_fh { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_fh: called CC=3 SCAR=11.2
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | # Get self ref, file handle | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3 | my ($tree_or, $html_fh)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 3 | debug("parse $html_fh"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # Delete any left over wedge segments | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 3 | delete $tree_or->{'_html_wedge_ar'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # Read over file handle until we get to the first non-comment line (ignores auto added copyright statements) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 3 | while (1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 3 | my $pos=tell($html_fh); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | my $line=<$html_fh>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | ▶ | if ($line=~/^#/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | ($tree_or->{'_line_no'} ||= 0)++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tree_or->{"_line_no"} ||= 0
MC/DC0%0/1
$tree_or->{"_line_no"} ||= 0
$tree_or->{"_line_no"}
Truth table0%0/2
A
A= $tree_or->{"_line_no"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $tree_or->{'_line_no_next'}=$tree_or->{'_line_no'}+1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | seek($html_fh, $pos, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 3 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # Return closure code ref that understands how to count line | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # numbers and wedge in extra code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 17 | ▶ | my $parse_cr=sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.2
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | # Read in lines of HTML, allowing for "wedged" bits, e.g. from start_html | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 17 | my $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 17 | ▶ | my $html=@{$tree_or->{'_html_wedge_ar'}} ? shift @{$tree_or->{'_html_wedge_ar'}} : ($line=<$html_fh>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 17 | ▶ | if ($line) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 11 | debug("line *$line*"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 11 | debug($tree_or->line_no_debug()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 11 | my @cr=($line=~/\n/g); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 11 | ▶ | $tree_or->{'_line_no'}=($tree_or->{'_line_no_next'} || 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$tree_or->{'_line_no_next'} || 1
MC/DC100%1/1
$tree_or->{'_line_no_next'} || 1
$tree_or->{'_line_no_next'}
Truth table100%2/2
A
A= $tree_or->{'_line_no_next'}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 11 | $tree_or->{'_line_no_next'}=$tree_or->{'_line_no'}+@cr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # Stop auto vivification via hash slice | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | #debug("Line %s, Line_no_next %s, Line_no_start %s cr %s", @{$tree_or}{qw(_line_no _line_no_next _line_no_start)}, scalar @cr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 11 | debug("Line %s, Line_no_next %s, Line_no_start %s cr %s", (map {$tree_or->{$_}} qw(_line_no _line_no_next _line_no_start)), scalar @cr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # To this or last line not processed by HTML::Parser properly (in one chunk) if no CR | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 17 | ▶ | if ($html_fh->eof() && $html) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$html_fh->eof and $html
MC/DC100%2/2
$html_fh->eof and $html
$html_fh->eof
$html
Truth table100%3/3
A and B
A= $html_fh->eofB= $html
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3 | debug("add CR at EOF"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 3 | ▶ | $html.=$/ unless $html=~/(?:\r?\n|\r)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # Ugly hack to fix @ type attribute names in Alpine and Vue. Need to be done in the Parser properly at | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # some stage | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 17 | ▶ | if (my $attr_convert=$WEBDYNE_ALPINE_VUE_ATTRIBUTE_HACK_ENABLE) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 17 | ▶ | if ($html =~ s{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | (<\s*[\w:-]+ # match the start of an HTML tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | (?:\s+[^>]*?)?) # non-greedy match of attributes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | \s@([\w\.-]+) # match attribute like @click or @keydown.enter | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | (\s*=\s*["'][^"']*["']) # match = "value" or = 'value' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | }{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | "$1 ${attr_convert}:$2$3" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | }egx) { #" # Fake quote to re-enable syntax highlighting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | debug("match on AlpineJS attribute syntax hack, line now: $line"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 17 | debug('no match on AlpineJS attribute syntax hack') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # Done, return HTML | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 17 | return $html; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 3 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 3 | return $parse_cr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub delete { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # Destroy tree, reset any globals | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $self=shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | debug('delete'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # Reset script and line number vars | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | delete $self->{'_html_wedge_ar'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # Run real deal from parent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | $self->SUPER::delete(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 47 | ▶ | sub tag_parse { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tag_parse: called CC=21 SCAR=40.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # Get our self ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 47 | my ($self, $method)=(shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # Get the tag, tag attr | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 47 | my ($tag, $attr_hr)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # Get rid of attribute multi-line value if the start with subst chars | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 47 | foreach my $attr (keys %{$attr_hr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 15 | my $attr_value=$attr_hr->{$attr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 15 | ▶ | if ($attr_value=~/([\$@%!+*^])\{(\1?)/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | # Get rid of cr/lf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | if ($attr_value=~s/\s*[\r\n]+\s*/ /g) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $attr_hr->{$attr}=$attr_value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | #map { $attr_hr->{$_}=($attr_hr->{$_}=~s/\s*[\r\n]+\s*/ /gr) } keys %{$attr_hr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # Debug. Amended to stop autovivification | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | #debug("tag_parse $method, tag: *%s*, line_no: %s, line_no_start: %s, attr_hr:%s ", $tag, @{$self}{qw(_line_no _line_no_start)}, Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 47 | debug("tag_parse $method, tag: *%s*, line_no: %s, line_no_start: %s, attr_hr:%s ", $tag, (map {$self->{$_}} qw(_line_no _line_no_start)), Dumper($attr_hr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | # Get the parent tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 47 | my $pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | my $tag_parent=( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | $pos=$self->{'_pos'} || $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 47 | ▶ | )->{'_tag'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'_pos'} || $self
MC/DC0%0/2
$self->{'_pos'} || $self
$self->{'_pos'}
$self
Truth table66%2/3
A || B
A= $self->{'_pos'}B= $self
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 47 | debug("tag $tag, tag_parent $tag_parent"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # Is chomp detected ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 47 | ▶ | if (delete $attr_hr->{'chomp'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | # Yes, flag for later processing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | debug('chomp attribute detected, setting flag'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->{'_chomp'}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | # Var to hold returned html element object ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 47 | my $html_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # If it is an below an implicit parent tag close that tag now. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | #if ($CGI_TAG_IMPLICIT{$tag_parent} || $tag_parent=~/^start_/i || $tag_parent=~/^end_/i) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 47 | ▶ | if ($CGI_TAG_IMPLICIT{$tag_parent} || ($tag_parent=~/^(?:start_|end_)/i)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
Condition33%1/3
$WebDyne::HTML::TreeBuilder::CGI_TAG_IMPLICIT{$tag_parent} or $tag_parent =~ /^(?:start_|end_)/i
MC/DC0%0/2
$WebDyne::HTML::TreeBuilder::CGI_TAG_IMPLICIT{$tag_parent} or $tag_parent =~ /^(?:start_|end_)/i
$WebDyne::HTML::TreeBuilder::CGI_TAG_IMPLICIT{$tag_parent}
$tag_parent =~ /^(?:start_|end_)/i
Truth table33%1/3
A or B
A= $WebDyne::HTML::TreeBuilder::CGI_TAG_IMPLICIT{$tag_parent}B= $tag_parent =~ /^(?:start_|end_)/i
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # End implicit parent if it was an implicit tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | debug("ending implicit parent tag $tag_parent"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $self->end($tag_parent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $html_or=$self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # Special case where <perl/block/etc> wraps <head> or <body> tags. HTML::TreeBuilder assumes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # head is always under html - we have to hack. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | ▶ | elsif ($CGI_TAG_WEBDYNE{$tag_parent} && ($tag eq 'head')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent} and $tag eq "head"
MC/DC0%0/2
$WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent} and $tag eq "head"
$WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent}
$tag eq "head"
Truth table66%2/3
A and B
A= $WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent}B= $tag eq "head"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # Debug and modify tree | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | debug("found $tag_parent above $tag, modifying tree"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $self->{'_head'}->preinsert($pos); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $self->{'_head'}->detach(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $pos->push_content($self->{'_head'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $html_or=$self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # Same for body tag as above | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | ▶ | elsif ($CGI_TAG_WEBDYNE{$tag_parent} && ($tag eq 'body')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent} and $tag eq "body"
MC/DC0%0/2
$WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent} and $tag eq "body"
$WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent}
$tag eq "body"
Truth table66%2/3
A and B
A= $WebDyne::HTML::TreeBuilder::CGI_TAG_WEBDYNE{$tag_parent}B= $tag eq "body"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | debug("found $tag_parent above $tag, modifying tree"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $self->{'_body'}->preinsert($pos); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | $self->{'_body'}->detach(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $pos->push_content($self->{'_body'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $html_or=$self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # If it is an custom webdyne tag, massage with methods below | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # before processing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | ▶ | elsif ($CGI_TAG_SPECIAL{$tag} && ($method ne 'SUPER::text')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$WebDyne::HTML::TreeBuilder::CGI_TAG_SPECIAL{$tag} and $method ne "SUPER::text"
MC/DC50%1/2
$WebDyne::HTML::TreeBuilder::CGI_TAG_SPECIAL{$tag} and $method ne "SUPER::text"
$WebDyne::HTML::TreeBuilder::CGI_TAG_SPECIAL{$tag}
$method ne "SUPER::text"
Truth table66%2/3
A and B
A= $WebDyne::HTML::TreeBuilder::CGI_TAG_SPECIAL{$tag}B= $method ne "SUPER::text"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # Yes, is WebDyne tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 6 | debug("webdyne tag_special ($tag) dispatch"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 6 | $html_or=$self->$tag($method, $tag, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | ▶ | elsif ((my ($modifier, $tag_actual)=($tag=~/^(start_|end_)(.*)/i)) && ($method ne 'SUPER::text')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
() = $tag =~ /^(start_|end_)(.*)/i and $method ne "SUPER::text"
MC/DC0%0/2
() = $tag =~ /^(start_|end_)(.*)/i and $method ne "SUPER::text"
() = $tag =~ /^(start_|end_)(.*)/i
$method ne "SUPER::text"
Truth table33%1/3
A and B
A= () = $tag =~ /^(start_|end_)(.*)/iB= $method ne "SUPER::text"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # Yes, is WebDyne tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | debug("webdyne tag start|end ($tag) dispatch, method $method"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | #if ($modifier=~/end_/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # debug('end tag so changing method to SUPER::end'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # $method='SUPER::end' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | #} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $html_or=$self->tag_parse($method, $tag_actual, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | # If it is an custom CGI tag that we need to close implicityly | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | #elsif ($CGI_TAG_IMPLICIT{$tag_parent} || $tag=~/^start_/i || $tag=~/^end_/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | elsif ($CGI_TAG_IMPLICIT{$tag_parent}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # Yes, is CGI tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | debug("webdyne tag_implicit ($tag) dispatch"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $html_or=$self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->end($tag) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # If its parent was a custom webdyne tag, the turn off implicitness | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # before processing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | elsif ($CGI_TAG_WEBDYNE{$tag_parent}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # Turn off implicitness here to stop us from being moved | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # around in the parse tree if we are under a table or some | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # such | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 2 | debug('turning off implicit tags'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | $self->implicit_tags(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # Run the WebDyne tag method. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 2 | debug("webdyne tag_parent ($tag_parent) dispatch"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | $html_or=$self->$tag_parent($method, $tag, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # Turn implicitness back on again | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 2 | debug('turning on implicit tags'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | $self->implicit_tags(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # Pass onto our base class for further processing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 39 | debug("base class method $method, %s", Dumper(\@_)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 39 | $html_or=$self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | # Do we have a HTML::Element object ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 47 | ▶ | if ((my $ref=ref($html_or)) eq 'HTML::Element') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # Yes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 18 | debug("parse returned $ref object, tag: %s, inserting line no", $html_or->tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 18 | @{$html_or}{'_line_no', '_line_no_tag_end'}=@{$self}{qw(_line_no_start _line_no)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ▶ | elsif ($ref && ($ref ne 'WebDyne::HTML::TreeBuilder')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ref and $ref ne "WebDyne::HTML::TreeBuilder"
MC/DC0%0/2
$ref and $ref ne "WebDyne::HTML::TreeBuilder"
$ref
$ref ne "WebDyne::HTML::TreeBuilder"
Truth table66%2/3
A and B
A= $refB= $ref ne "WebDyne::HTML::TreeBuilder"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # That's weird .. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | return err("parse returned $ref object, expected 'WebDyne::HTML::Element'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # Text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 29 | debug('parse returned text (scalar) object'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # Returm object ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 47 | $html_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | sub block { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
block: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # No special handling needed, just log for debugging purposes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my ($self, $method)=(shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | debug("block self $self, method $method, *%s* text_block_tag %s", join('*', @_), $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | $self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | sub script { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
script: not called CC=3 SCAR=21.3
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | my ($self, $method, $tag, $attr_hr, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 1 | ▶ | no warnings 'qw'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | debug("$self script, attr: %s", Dumper($attr_hr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my $script_or=$self->$method($tag, $attr_hr, @param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | ▶ | if ($attr_hr->{'type'} eq 'application/perl') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | my $perl_or=HTML::Element->new('perl', inline => 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | push @{$self->{'_script_stack'}}, [$script_or, 'perl', $perl_or]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | debug('perl script !'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | push @{$self->{'_script_stack'}}, undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | $self->_text_block_tag('script') unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | #$self->$method($tag, $attr_hr, @param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | return $script_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | sub json0 { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
json0: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # No special handling needed, just log for debugging purposes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | my ($self, $method, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | $self->_text_block_tag('json') unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | debug("self $self, tag: json, method: $method text_block_tag %s", $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | return $self->$method(@param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | sub table { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
table: not called CC=3 SCAR=24.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | # Modify HTML::Tagset to allow perl/block/htmx tags within a table tag, then pull them out | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | # when the table tag closes. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | my ($self, $method, $tag, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | debug("self $self, tag: $tag, method: $method"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | if ($method eq 'SUPER::start') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | map { $HTML::Tagset::isTableElement{$_}=1 } qw(perl block htmx) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | elsif ($method eq 'SUPER::end') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | map { delete $HTML::Tagset::isTableElement{$_} } qw(perl block htmx) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | return $self->$method($tag, @param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | sub htmx { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
htmx: not called CC=5 SCAR=34.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # Handle normally but set flag showing we are an <htmx> page, will optimise differently | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | my ($self, $method, $tag, $attr_hr, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | debug("self $self, tag: htmx, method: $method, param: %s", Dumper($attr_hr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | $self->{'_webdyne_compact'}=$tag if ($attr_hr->{'compact'} || $attr_hr->{'bare'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$attr_hr->{"compact"} or $attr_hr->{"bare"}
MC/DC0%0/2
$attr_hr->{"compact"} or $attr_hr->{"bare"}
$attr_hr->{"compact"}
$attr_hr->{"bare"}
Truth table0%0/3
A or B
A= $attr_hr->{"compact"}B= $attr_hr->{"bare"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | if (delete $attr_hr->{'perl'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | my $html_perl_or=$self->$method($tag, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $self->_html_perl_or($html_perl_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | ▶ | $self->_text_block_tag($tag) unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | return $html_perl_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | return $self->$method($tag, $attr_hr, @param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | sub api { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
api: not called CC=3 SCAR=24.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # Handle normally but set flag showing we are an <api> page, will optimise differently | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | my ($self, $method, $tag, $attr_hr, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | debug("self $self, tag: api, method: $method"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | $self->{'_webdyne_compact'}=$tag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | if (delete $attr_hr->{'perl'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | my $html_perl_or=$self->$method($tag, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | $self->_html_perl_or($html_perl_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | $self->_text_block_tag($tag) unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | return $html_perl_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | return $self->$method($tag, $attr_hr, @param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | ▶ | sub json { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
json: not called CC=3 SCAR=24.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | # No special handling needed, just log for debugging purposes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | my ($self, $method, $tag, $attr_hr, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | debug("self $self, tag: api, method: $method"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | if (delete $attr_hr->{'perl'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | my $html_perl_or=$self->$method($tag, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $self->_html_perl_or($html_perl_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | $self->_text_block_tag($tag) unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | return $html_perl_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | return $self->$method($tag, $attr_hr, @param); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | sub style { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
style: not called CC=2 SCAR=17.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | my ($self, $method)=(shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | debug('style'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | $self->_text_block_tag('style') unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | return $self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 5 | ▶ | sub perl { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
perl: called CC=5 SCAR=19.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | # Special handling of perl tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 5 | my ($self, $method, $tag, $attr_hr)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 5 | debug("tag: *$tag* method: $method"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | # Call SUPER method, check if inline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 5 | my $html_perl_or=$self->$method($tag, $attr_hr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 5 | my $inline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 5 | ▶ | if ($tag eq 'perl') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 3 | ▶ | unless (grep {exists $attr_hr->{$_}} qw(package method handler)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | $html_perl_or->attr(inline => ++$inline); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | debug("inline: $inline"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 5 | ▶ | if ($inline) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | # Inline tag, set global var to this element so any extra text can be | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | # added here | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | $self->_html_perl_or($html_perl_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | $self->_text_block_tag($tag) unless $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | # And return it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | return $html_perl_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # Not inline, just return object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 5 | return $html_perl_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | sub process { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # Rough and ready process handler, try to handle perl code in <? .. ?>. Not sure if I really | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # want to support this yet ... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | my ($self, $text)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | debug("process $text"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | # Create perl HTMl::Object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my $html_or=HTML::Element->new('perl', inline => 1, perl => $text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | debug("insert line_no: %s into object ref $html_or", $self->{'_line_no'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | @{$html_or}{'_line_no', '_line_no_tag_end'}=@{$self}{qw(_line_no _line_no)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | return $self->tag_parse('SUPER::text', $html_or) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 24 | ▶ | sub start { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=3 SCAR=11.1
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | # Ugly, make sure if in perl or script tag, whatever we see counts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | # as text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 24 | my ($self, $tag)=(shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 24 | my $text=$_[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 24 | ▶ | ref($tag) || ($tag=lc($tag)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 24 | debug("$self start tag '$tag' line_no: %s, %s", $self->{'_line_no'}, Dumper(\@_)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 24 | my $html_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 24 | ▶ | if ($self->_text_block_tag()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $html_or=$self->text($text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 24 | my @cr=($text=~/\n/g); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 24 | $self->{'_line_no_start'}=$self->{'_line_no'}-@cr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | # Amend to stop autovivification | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | #debug("tag $tag line_no: %s, line_no_start: %s", @{$self}{qw(_line_no _line_no_start)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 24 | debug("tag $tag line_no: %s, line_no_start: %s", (map {$self->{$_}} qw(_line_no _line_no_start))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 24 | $html_or=$self->tag_parse('SUPER::start', $tag, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 24 | $html_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 7 | ▶ | sub end { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: called CC=23 SCAR=57.5
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | # Ugly special case conditions, ensure end tag between perl or script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | # blocks are treated as text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 7 | my ($self, $tag)=(shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 7 | ▶ | ref($tag) || ($tag=lc($tag)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 7 | debug("$self end tag: %s,%s text_block_tag: %s, line_no: %s", Dumper($tag, \@_), $self->_text_block_tag(), $self->{'_line_no'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 7 | debug($self->line_no_debug()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | #debug('self: %s', Dumper($self)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # Var to hold HTML::Element ref if returned, but most methods don't seem to return a HTML ref, just an integer ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 7 | my $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | # Div tag gets handles specially as start tag might have been a webdyne tag aliases into a div tag (see div tag for more details) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 7 | ▶ | if ($tag eq 'div') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | # Hit on div, check | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | debug("hit on div tag: $tag"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | # Can we pop an array ref off div_stack ? If so means was webdyne tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | #if (my $div_ar=pop(@div_stack)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | if (my $div_ar=pop(@{$self->{'_div_stack'}})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | # Yes, separate out to components stored by div subroutine | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my ($div_or, $webdyne_tag, $webdyne_tag_or)=@{$div_ar}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | debug("popped div tag: $div_or, %s, about to end webdyne tag: $webdyne_tag (%s)", $div_or->tag(), $webdyne_tag_or->tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | # Set the Text_fg to whatever the webdyne tag was (e.g. perl, etc), that way they will see a match and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # turn off text mode. NOTE: Not sure this works ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | $self->_text_block_tag($webdyne_tag_or->tag()) if $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | debug("text_block_tag now %s, ending $webdyne_tag", $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $self->SUPER::end($webdyne_tag, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | # Now end the original div tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | debug("ending $tag now"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | $ret=$self->SUPER::end($tag, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | # Can now unset text flag. See NOTE above, need to check this | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $self->_text_block_tag(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | # Now replace div tag with webdyne output unless a wrap attribute exists or class etc. given - in which | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | # case the output will be wrapped in that tag and any class, style or id tags presevered | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | my @div_attr_name=grep {$div_or->attr($_)} qw(class style id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | ▶ | if ((my $tag=$div_or->attr('wrap')) || @div_attr_name) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
my $tag = $div_or->attr("wrap") or @div_attr_name
MC/DC0%0/2
my $tag = $div_or->attr("wrap") or @div_attr_name
my $tag = $div_or->attr("wrap")
@div_attr_name
Truth table0%0/3
A or B
A= my $tag = $div_or->attr("wrap")B= @div_attr_name
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | # Want to wrap output in another tag or use <div> if class etc. given but no tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | $tag ||= 'div'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$tag ||= "div"
MC/DC0%0/1
$tag ||= "div"
$tag
Truth table0%0/2
A
A= $tag
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | $webdyne_tag_or->push_content($div_or->detach_content()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | my %tag_attr=( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | map {$_ => $div_or->attr($_)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | @div_attr_name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | debug("tag: $tag, tag_attr: %s", Dumper(\%tag_attr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | my $tag_or=HTML::Element->new($tag, %tag_attr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | $tag_or->push_content($webdyne_tag_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | $div_or->replace_with($tag_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | $webdyne_tag_or->push_content($div_or->detach_content()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | $div_or->replace_with($webdyne_tag_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | return $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | # Vanilla div tag, nothing to do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | debug('undef pop off div stack'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | return $ret=$self->SUPER::end($tag, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | elsif ($tag eq 'script') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | # Script tag, presumably of type application/perl | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | debug('hit on script tag'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # Can we pop an array ref off script_stack ? If so means was webdyne tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ▶ | if (my $script_ar=pop(@{$self->{'_script_stack'}})) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | # Get vars from array ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | my ($script_or, $perl_tag, $perl_tag_or)=@{$script_ar}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | debug("popped script tag: $script_or, %s, about to end perl tag: $perl_tag (%s)", $script_or->tag(), $perl_tag_or->tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | # End perl tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | debug("end $perl_tag now"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | ▶ | $self->_text_block_tag($perl_tag_or->tag()) if $self->_text_block_tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | debug("text_block_tag now %s, ending $perl_tag", $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | $self->SUPER::end($perl_tag, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | # End script tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | debug("end $tag now"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | $self->SUPER::end($tag, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | $self->_text_block_tag(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | # Re-arrange tree | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | debug('script content %s', Dumper($script_or->content_list)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | #$perl_tag_or->push_content($script_or->detach_content()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | $perl_tag_or->attr('perl', $script_or->detach_content()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $script_or->replace_with($perl_tag_or); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | elsif (0) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | debug('null script stack pop, ignoring'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | $self->_text_block_tag(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | return $ret=$self->SUPER::end($tag, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 7 | ▶ | if ($self->_text_block_tag() && ($tag eq $self->_text_block_tag())) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$self->_text_block_tag and $tag eq $self->_text_block_tag
MC/DC0%0/2
$self->_text_block_tag and $tag eq $self->_text_block_tag
$self->_text_block_tag
$tag eq $self->_text_block_tag
Truth table33%1/3
A and B
A= $self->_text_block_tagB= $tag eq $self->_text_block_tag
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | debug("match on tag $tag to text_block_tag %s, clearing text_block_tag", $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | $self->_text_block_tag(undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | $ret=$self->SUPER::end($tag, @_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | elsif ($self->_text_block_tag()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | debug('text segment via text_block_tag %s, passing to text handler', $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $ret=$self->text($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | ▶ | elsif (!$_[0] && delete($self->{'_end_ignore'})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not $_[0] and delete $self->{"_end_ignore"}
MC/DC0%0/2
not $_[0] and delete $self->{"_end_ignore"}
not $_[0]
delete $self->{"_end_ignore"}
Truth table33%1/3
not(A) and B
A= not $_[0]B= delete $self->{"_end_ignore"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | # In this case $_[0] is the actual text of the end tag from the document. If the parser is signalling and end of a tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | # but $_[0] is empty it means it is an implicit close. We might want to ignore it, especially if it is triggered by a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | # <div data-webdyne-perl> type tag. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | debug("attempt to close tag: $tag with active _div_stack, ignoring"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | $ret=undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 7 | debug("normal tag end: $tag, %s", $self->pos()->tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 7 | ▶ | $self->pos()->{'_line_no_tag_end'}=$self->{'_line_no'} if (ref($self->pos()) eq 'HTML::Element'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 7 | $ret=$self->SUPER::end($tag, @_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | # Done, return | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 7 | debug("end ret $ret"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 7 | return $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | # Reminder to self. Keep this in, or implicit CGI tags will not be closed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | # if text block follows implicit CGI tag immediately | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 29 | ▶ | sub text { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text: called CC=13 SCAR=28.2
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | # get self ref, text we will process | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 29 | my ($self, $text)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 29 | debug('text *%s*, text_block_tag %s, pos: %s', $text, $self->_text_block_tag(), $self->{'_pos'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | # Are we chomping text ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 29 | ▶ | if (delete $self->{'_chomp'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | # Yes. It's actually includes a "pre-chomp" as newline will be at start of the string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | debug('chomp flag detected, chomping text'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | $text=~s/^\n//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | # Ignore empty text. UPDATE - don't ignore or you will mangle CR in <pre> sections, especially if they contain tags | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | # like <span> in the <pre> section. Process and keep them inline. See also fact that trailing and leading CR's are | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | # converted to space characters by HTML::Parser as per convention. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | # Leave this here as a reminder. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | #return if ($text =~ /^\r?\n?$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | # Are we in an inline perl block ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | #if ($self->_text_block_tag() eq 'perl') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 29 | ▶ | if (grep { $self->_text_block_tag() eq $_ } qw(perl htmx api json)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | # Yes. We have inline perl code, not text. Just add to perl attribute, which | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | # is treated specially when rendering | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 3 | debug('in <perl> tag, appending text to <perl> block'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 3 | my $html_perl_or=$self->_html_perl_or(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 3 | $html_perl_or->{'perl'}.=$text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 3 | $html_perl_or->{'_line_no_tag_end'}=$self->{'_line_no'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | # Used to do this so __PERL__ block would only count if at end of file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | #elsif (($text=~/^\W*__CODE__/ || $text=~/^\W*__PERL__/) && !$self->{'_pos'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | ▶ | elsif (($text=~/^\W*__CODE__/ || $text=~/^\W*__PERL__/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$text =~ /^\W*__CODE__/ or $text =~ /^\W*__PERL__/
MC/DC50%1/2
$text =~ /^\W*__CODE__/ or $text =~ /^\W*__PERL__/
$text =~ /^\W*__CODE__/
$text =~ /^\W*__PERL__/
Truth table66%2/3
A or B
A= $text =~ /^\W*__CODE__/B= $text =~ /^\W*__PERL__/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | # Close off any HTML | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 3 | ▶ | delete $self->{'_pos'} if $self->{'_pos'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | # Perl code fragment. Will be last thing we do, as __PERL__ must be at the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | # bottom of the file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 3 | debug('found __PERL__ tag'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 3 | $self->_text_block_tag('perl'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 3 | $self->implicit(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 3 | my $html_perl_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 3 | $self->push_content($self->_html_perl_or($html_perl_or=HTML::Element->new('perl', inline => 1))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | # Amended to stop autovivification | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | #debug('insert line_no: %s into object ref: %s', @{$self}{qw(_line_no _html_perl_or)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 3 | debug('insert line_no: %s into object ref: %s', (map {$self->{$_}} qw(_line_no _html_perl_or))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 3 | @{$html_perl_or}{qw(_line_no _line_no_tag_end)}=@{$self}{qw(_line_no _line_no)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 3 | $html_perl_or->{'_code'}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | elsif ($text=~/^\W*__END__/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | # End of file | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | debug('found __END__ tag, running eof'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | $self->eof(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | # Normal text, process by parent class after handling any subst flags in code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 23 | ▶ | if ($text=~/([\$!+\^*]+)\{([\$!+]?)(.*?)\2\}/s) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | # Meeds subst. Get rid of cr's at start and end of text after a <perl> tag, stuffs up formatting in <pre> sections | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | # Amend to stop autovivification | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | #debug("found subst tag line_no_start: %s, line_no: %s, text '$text', script_stack: %s, %s", @{$self}{qw(_line_no_start _line_no _script_stack)}, Dumper($self->{'_script_stack'})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 1 | debug("found subst tag line_no_start: %s, line_no: %s, text '$text', script_stack: %s, %s", (map {$self->{$_}} qw(_line_no_start _line_no _script_stack)), Dumper($self->{'_script_stack'})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | #my @cr=($text=~/\n/g); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | #if (my $html_or=$self->{'_pos'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | # debug("parent %s", $html_or->tag()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | # if (($html_or->tag() eq 'perl') && !$html_or->attr('inline')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | # debug('hit !'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | # # Why did I comment this out ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | # # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | # #$text=~s/^\n//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | # #$text=~s/\n$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | # } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | #} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | # If in <script> block we probably don't want to be running subst over strings we find because ${varname} is valid Javascript | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | # syntax and we shouldn't reallt ever need to subs in a script block (user can pass params to script). Nevertheless we'll give | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | # them a subst option if they want | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 1 | my $html_or=$self->{'_pos'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 1 | my %attr=$html_or->all_external_attr(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | # Gets a bit ugly for <script> tags. If <script> is Javascript *dont* run subst over it unless the user insists. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | # First - are we inside a script tag. Easiest way is to see if in script_stack | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 1 | ▶ | if (@{$self->{'_script_stack'}} && (!$attr{'type'} || $WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR->{$attr{'type'}}) && !$attr{'subst'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition22%2/9
@{$self->{"_script_stack"};} and !$attr{"type"} || $$WebDyne::HTML::TreeBuilder::WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR{$attr{"type"}} and not $attr{"subst"}
@{$self->{"_script_stack"};} and !$attr{"type"} || $$WebDyne::HTML::TreeBuilder::WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR{$attr{"type"}}
not $attr{"type"} or $$WebDyne::HTML::TreeBuilder::WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR{$attr{"type"}}
MC/DC0%0/4
@{$self->{"_script_stack"};} and !$attr{"type"} || $$WebDyne::HTML::TreeBuilder::WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR{$attr{"type"}} and not $attr{"subst"}
@{$self->{"_script_stack"};}
not $attr{"type"}
$$WebDyne::HTML::TreeBuilder::WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR{$attr{"type"}}
not $attr{"subst"}
Truth table16%1/6
A and not(B) or C and not(D)
A= @{$self->{"_script_stack"};}B= not $attr{"type"}C= $$WebDyne::HTML::TreeBuilder::WEBDYNE_SCRIPT_TYPE_EXECUTABLE_HR{$attr{"type"}}D= not $attr{"subst"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | #if (@{$self->{'_script_stack'}} && !$attr{'subst'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | debug("script_stack present, bypass susbt: parent %s, attr: %s", $html_or->tag(), Dumper(\%attr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | $self->tag_parse('SUPER::text', $text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | elsif ($attr{'nosubst'}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | debug('nosubst attr found in attr: %s', Dumper(\%attr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | $self->tag_parse('SUPER::text', $text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 1 | my $html_subst_or=HTML::Element->new('subst'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | # Amend to stop autovivification | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | #debug("insert line_no: %s, line_no_tag_end: %s into object ref $html_subst_or for text $text", @{$self}{qw(_line_no_start _line_no)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 1 | debug("insert line_no: %s, line_no_tag_end: %s into object ref $html_subst_or for text $text", (map {$self->{$_}} qw(_line_no_start _line_no))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 1 | @{$html_subst_or}{'_line_no', '_line_no_tag_end'}=@{$self}{qw(_line_no _line_no)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 1 | $html_subst_or->push_content($text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 1 | $self->tag_parse('SUPER::text', $html_subst_or) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | # No subst, process as normal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 22 | debug('processing as normal text'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 22 | $self->tag_parse('SUPER::text', $text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | # Return self ref. Not really sure if this is what we should really return, but | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | # seems to work | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 29 | $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | ▶ | sub comment { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: not called CC=1 SCAR=6.9
Pod
documented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | # Handle comments in HTML. Get HTML::Element ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | my $self=shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | my $html_or=$self->SUPER::comment(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | debug("$self html_or: $html_or comment: %s", Dumper(\@_)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | # Change tag to 'comment' from '~comment' so we can call comment render sub in WebDyne::HTML::Tidy (can't call sub starting with ~ in perl) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | #$self->tag('comment'); # No longer needed, make ~comment sub work in WebDyne::HTML::Tiny | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | debug("insert line_no: %s into object ref $self", $self->{'_line_no'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | @{$html_or}{qw(_line_no _line_no_tag_end)}=@{$self}{qw(_line_no_start _line_no)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 0 | return $html_or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 3 | ▶ | sub start_html { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_html: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | # Handle this specially, inject into parser after rendering | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 3 | my ($self, $method, $tag, $attr_hr)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 3 | debug("self: $self, method: $method, tag: $tag, attr_hr: %s", Dumper($attr_hr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 3 | push @{$self->{'_html_wedge_ar'}}, (my $html=$self->{'_html_tiny_or'}->$tag($attr_hr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 3 | return $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | ▶ | sub end_html { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_html: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | &start_html(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 0 | ▶ | sub start_form { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_form: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | &start_html(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | ▶ | sub end_form { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_form: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | &start_html(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | ▶ | sub start_multipart_form { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_multipart_form: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | &start_html(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | ▶ | sub end_multipart_form { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_multipart_form: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 0 | &start_html(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | ▶ | sub include { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
include: not called CC=1 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | # No special handling needed, just log for debugging purposes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 0 | my ($self, $method)=(shift, shift); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 0 | debug("block self $self, method $method, @_ text_block_tag %s", $self->_text_block_tag()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 0 | $self->$method(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | ▶ | sub div { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
div: not called CC=5 SCAR=34.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | # Handle div tag specially, looking if they hold any webdyne aliases | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | my ($self, $method, $tag, $attr_hr, @param)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | debug("$self in $tag, method:$method attr:%s", Dumper($attr_hr)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | # Get the div tag HTML::Element ref. Note now do this later in (if) blocks because it triggeres | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | # auto-close if implicit tags like <p>, which we want to flag and stop happening if it's a webdyne | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | # flag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | #my $div_or=$self->$method($tag, $attr_hr, @param) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | # return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | # Do we have a pseudo webdyne command aliased in a div tag with a "data-webdyne" attributre (usually to keep a HTML editor happy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | # because it doesn't know anything about native webdyne tags | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | ▶ | if (my @tag=grep {/^data-webdyne-/} keys %{$attr_hr}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | # Set end_ignore flag to ignore parser trying to auto-close <p> etc. when we run this tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | $self->{'_end_ignore'}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 0 | ▶ | my $div_or=$self->$method($tag, $attr_hr, @param) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->$method($tag, $attr_hr, @param) || (return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)))
MC/DC0%0/1
$self->$method($tag, $attr_hr, @param) || (return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)))
$self->$method($tag, $attr_hr, @param)
Truth table0%0/2
A
A= $self->$method($tag, $attr_hr, @param)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | # Yes, we have one, get it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | my $webdyne_tag=$tag[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | # And delete it from attribute list so it doesn't pollute, strip off data-webdyne lead | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | delete $attr_hr->{$webdyne_tag}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | $webdyne_tag=~s/^data-webdyne-//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | debug("found webdyne tag $webdyne_tag in div"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | # Convert to a start tag for HTML Tiny | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | my $html_tiny_tag="start_${webdyne_tag}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | # Var to hold HTML::Element version of tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | debug("generating $html_tiny_tag"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | ▶ | my $webdyne_tag_or=$self->tag_parse('SUPER::start', $webdyne_tag, $attr_hr, @param) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->tag_parse('SUPER::start', $webdyne_tag, $attr_hr, @param) || (return err("unable to create HTML::Element ref for tag:$webdyne_tag, attr_hr:%s", Dumper($attr_hr)))
MC/DC0%0/1
$self->tag_parse('SUPER::start', $webdyne_tag, $attr_hr, @param) || (return err("unable to create HTML::Element ref for tag:$webdyne_tag, attr_hr:%s", Dumper($attr_hr)))
$self->tag_parse('SUPER::start', $webdyne_tag, $attr_hr, @param)
Truth table0%0/2
A
A= $self->tag_parse('SUPER::start', $webdyne_tag, $attr_hr, @param)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | return err("unable to create HTML::Element ref for tag:$webdyne_tag, attr_hr:%s", Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | # Now push onto div stack and return div HTML::Element ref | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | push @{$self->{'_div_stack'}}, [$div_or, $webdyne_tag, $webdyne_tag_or]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | return $div_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | # Normal div tag, push undef onto stack to denote vanilla | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | debug('hit on vanilla div tag'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | ▶ | my $div_or=$self->$method($tag, $attr_hr, @param) || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->$method($tag, $attr_hr, @param) || (return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)))
MC/DC0%0/1
$self->$method($tag, $attr_hr, @param) || (return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)))
$self->$method($tag, $attr_hr, @param)
Truth table0%0/2
A
A= $self->$method($tag, $attr_hr, @param)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | return err('unable to get HTML::Element ref for div tag: $tag, attr:%s', Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | push @{$self->{'_div_stack'}}, undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | return $div_or; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | # Getter setter. Not used for line numbers yet, prep for future cleanup | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 199 | ▶ | sub _get_set { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_set: called CC=3 SCAR=11.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | 199 | my ($key, $self, $value)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 199 | ▶ | debug("$self, key: $key, value: $value, store: %s", ($self->{$key} || '<none>')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{$key} || '<none>'
MC/DC100%1/1
$self->{$key} || '<none>'
$self->{$key}
Truth table100%2/2
A
A= $self->{$key}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 199 | ▶ | return (@_==3) ? $self->{$key}=$value : $self->{$key} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | map { eval("sub $_ { &_get_set($_, \@_) }") } qw(_text_block_tag _line_no _line_no_next _line_no_start _html_perl_or); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_html_perl_or: called CC=1 SCAR=0.8
Subroutine
_line_no: not called CC=1 SCAR=0.8
Subroutine
_line_no_next: not called CC=1 SCAR=0.8
Subroutine
_line_no_start: not called CC=1 SCAR=0.8
Subroutine
_text_block_tag: called CC=1 SCAR=0.8
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | # Done | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 1 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||