| 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::Compile; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Pragma | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 30 | ▶ | use strict qw(vars); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 30 | ▶ | use vars qw($VERSION %CGI_TAG_WEBDYNE %CGI_TAG_FORM %CGI_TAG_IMPLICIT); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 30 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 30 | ▶ | no warnings qw(uninitialized redefine once); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # External Modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 30 | ▶ | use WebDyne; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 30 | ▶ | use WebDyne::HTML::TreeBuilder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 30 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 30 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 30 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # WebDyne Modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 30 | ▶ | use WebDyne::HTML::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 30 | ▶ | use WebDyne::Constant; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 30 | ▶ | use WebDyne::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # Version information | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 30 | $VERSION='3.029'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # Debug load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 30 | 0 && debug("Loading %s version $VERSION", __PACKAGE__); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # Get WebDyne and CGI tags from TreeBuilder module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 30 | *CGI_TAG_WEBDYNE=\%WebDyne::CGI_TAG_WEBDYNE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 30 | *CGI_TAG_FORM=\%WebDyne::HTML::TreeBuilder::CGI_TAG_FORM; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 30 | *CGI_TAG_IMPLICIT=\%WebDyne::HTML::TreeBuilder::CGI_TAG_IMPLICIT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # Var to hold package wide hash, for data shared across package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 30 | my %Package; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # All done. Positive return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | #================================================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # Packace init, attempt to load optional Time::HiRes module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 30 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 30 | eval {require Time::HiRes; Time::HiRes->import('time')}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 30 | eval {require Devel::Confess; Devel::Confess->import(qw(no_warnings))}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 30 | ▶ | eval {} if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 129 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # Only used when debugging from outside apache, eg test script. If so, user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # must create new object ref, then run the compile. See wdcompile script for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # example. wdcompile is only used for debugging - we do some q&d stuff here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # to make it work | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 129 | my ($class, @opt)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 129 | ▶ | my %opt=(ref($opt[0]) eq 'HASH') ? %{$opt[0]} : @opt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 129 | 0 && debug("$class, opt: %s", Dumper(\%opt)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | # Init WebDyne module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 129 | require WebDyne::Request::Fake; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 129 | ▶ | my $r=WebDyne::Request::Fake->new( filename=> ( $opt{'filename'} || $opt{'srce'} ), no_head_insert=>$opt{'no_head_insert'} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opt{'filename'} || $opt{'srce'}
MC/DC0%0/2
$opt{'filename'} || $opt{'srce'}
$opt{'filename'}
$opt{'srce'}
Truth table66%2/3
A || B
A= $opt{'filename'}B= $opt{'srce'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # Get appropriate cgi_or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 129 | ▶ | my $html_tag_or=WebDyne::HTML::Tiny->new(mode => $WEBDYNE_HTML_TINY_MODE, r=>$r ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'WebDyne::HTML::Tiny'->new('mode', $WebDyne::Compile::WEBDYNE_HTML_TINY_MODE, 'r', $r) || (return err('unable to get new WebDyne::HTML::Tiny object'))
MC/DC0%0/1
'WebDyne::HTML::Tiny'->new('mode', $WebDyne::Compile::WEBDYNE_HTML_TINY_MODE, 'r', $r) || (return err('unable to get new WebDyne::HTML::Tiny object'))
'WebDyne::HTML::Tiny'->new('mode', $WebDyne::Compile::WEBDYNE_HTML_TINY_MODE, 'r', $r)
Truth table50%1/2
A
A= 'WebDyne::HTML::Tiny'->new('mode', $WebDyne::Compile::WEBDYNE_HTML_TINY_MODE, 'r', $r)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | return err('unable to get new WebDyne::HTML::Tiny object'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # New self ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 129 | my %self=( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | _r => $r, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | _CGI => $html_tag_or, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # And return blessed ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 129 | return bless(\%self, 'WebDyne'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1821 | ▶ | sub compile { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile: called CC=79 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Compile HTML file into Storable structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1821 | my ($self, $param_hr)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # Start timer so we can log how long it takes us to compile a file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1821 | my $time=($self->{'_time'}=time()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # Init class if not yet done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1821 | ▶ | (ref($self))->{_compile_init} ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref($self)->{"_compile_init"} ||= do {
$self->compile_init or return err()
}
MC/DC0%0/2
ref($self)->{"_compile_init"} ||= do {
$self->compile_init or return err()
}
ref($self)->{"_compile_init"}
do {
$self->compile_init or return err()
}
Truth table66%2/3
A ||= B
A= ref($self)->{"_compile_init"}B= do {
$self->compile_init or return err()
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 30 | ▶ | $self->compile_init() || return err() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->compile_init || (return err())
MC/DC0%0/1
$self->compile_init || (return err())
$self->compile_init
Truth table50%1/2
A
A= $self->compile_init
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # Debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1821 | 0 && debug('compile %s', Dumper($param_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # Get srce and dest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 1821 | my ($html_cn, $dest_cn)=@{$param_hr}{qw(srce dest)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # Need request object ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 1821 | ▶ | my $r=$self->{'_r'} || $self->r() || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$self->{'_r'} || $self->r || (return err())
$self->{"_r"} or $self->r
MC/DC0%0/2
$self->{'_r'} || $self->r || (return err())
$self->{"_r"}
$self->r
Truth table33%1/3
A or B
A= $self->{"_r"}B= $self->r
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Open the file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1821 | ▶ | my $html_fh=IO::File->new($html_cn, O_RDONLY) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'IO::File'->new($html_cn, 0) || (return err("unable to open file $html_cn, $!"))
MC/DC0%0/1
'IO::File'->new($html_cn, 0) || (return err("unable to open file $html_cn, $!"))
'IO::File'->new($html_cn, 0)
Truth table50%1/2
A
A= 'IO::File'->new($html_cn, 0)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | return err("unable to open file $html_cn, $!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # Keep trailing __PERL__/__CODE__ bodies out of HTML::Parser. The marker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # itself still goes through TreeBuilder so the normal internal perl node is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # created, but operators like s/</.../ are not tokenised as HTML. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1821 | my $perl_sr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1821 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1821 | my $source=<$html_fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1821 | ▶ | if ($source=~/\A(.*?)(^[ \t]*__(?:PERL|CODE)__\b[^\r\n]*(?:\r?\n|\r)?)(.*)\z/sm) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 658 | my ($html, $marker, $perl)=($1, $2, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 658 | $html.=$marker; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 658 | $perl_sr=\$perl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 658 | ▶ | open(my $html_split_fh, '<', \$html) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | return err("unable to open scalar source for $html_cn, $!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 658 | $html_fh=$html_split_fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1821 | ▶ | unless ($perl_sr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1163 | ▶ | seek($html_fh, 0, 0) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | return err("unable to rewind file $html_cn, $!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # Read over file handle until we get to the first non-comment line (ignores auto added copyright statements). Update - do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # this in Treebuilder code now so can account for comments when counting line numbers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1821 | while (0) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | my $pos=tell($html_fh); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | my $line=<$html_fh>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | if ($line=~/^#/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | seek($html_fh, $pos, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # Supply html_tiny object ref to Treebuilder so it can run things like start_html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 1821 | ▶ | my $html_tiny_or=$self->html_tiny() || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->html_tiny || (return err('unable to get html_tiny_or ref'))
MC/DC0%0/1
$self->html_tiny || (return err('unable to get html_tiny_or ref'))
$self->html_tiny
Truth table50%1/2
A
A= $self->html_tiny
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | return err('unable to get html_tiny_or ref'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # Get new TreeBuilder object. Note api_version flows through to HTML::Parser constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1821 | ▶ | my $tree_or=WebDyne::HTML::TreeBuilder->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
'WebDyne::HTML::TreeBuilder'->new('api_version', 3, 'html_tiny_or', $html_tiny_or, 'r', $r) || (return err('unable to create HTML::TreeBuilder object'))
MC/DC0%0/1
'WebDyne::HTML::TreeBuilder'->new('api_version', 3, 'html_tiny_or', $html_tiny_or, 'r', $r) || (return err('unable to create HTML::TreeBuilder object'))
'WebDyne::HTML::TreeBuilder'->new('api_version', 3, 'html_tiny_or', $html_tiny_or, 'r', $r)
Truth table50%1/2
A
A= 'WebDyne::HTML::TreeBuilder'->new('api_version', 3, 'html_tiny_or', $html_tiny_or, 'r', $r)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | api_version => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | html_tiny_or => $html_tiny_or, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | r => $r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ) || return err('unable to create HTML::TreeBuilder object'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # Make sure this is off | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 1821 | $tree_or->unbroken_text(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # Tell HTML::TreeBuilder we do *not* want to ignore tags it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # considers "unknown". Since we use <PERL> and <BLOCK> tags, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # amongst other things, we need these to be in the tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1821 | $tree_or->ignore_unknown(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # Tell it if we also want to see comments, use XML mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | $tree_or->store_comments(exists($param_hr->{'store_comments'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1821 | ▶ | ? $param_hr->{'store_comments'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | : $WEBDYNE_STORE_COMMENTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1821 | $tree_or->xml_mode(1); # Older versions on HTML::TreeBuilder | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | # No space compacting ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | $tree_or->ignore_ignorable_whitespace(exists($param_hr->{'ignore_ignorable_whitespace'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1821 | ▶ | ? $param_hr->{'ignore_ignorable_whitespace'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | : $WEBDYNE_COMPILE_IGNORE_WHITESPACE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | $tree_or->no_space_compacting(exists($param_hr->{'no_space_compacting'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1821 | ▶ | ? $param_hr->{'no_space_compacting'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | : $WEBDYNE_COMPILE_NO_SPACE_COMPACTING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # Get code ref closure of file to be parsed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 1821 | ▶ | my $parse_cr=$tree_or->parse_fh($html_fh) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tree_or->parse_fh($html_fh) || (return err())
MC/DC0%0/1
$tree_or->parse_fh($html_fh) || (return err())
$tree_or->parse_fh($html_fh)
Truth table50%1/2
A
A= $tree_or->parse_fh($html_fh)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # Muck around with strictness of P tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | $tree_or->p_strict( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | exists($param_hr->{'p_strict'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 1821 | ▶ | ? $param_hr->{'p_strict'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | : $WEBDYNE_COMPILE_P_STRICT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | $tree_or->implicit_body_p_tag( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | exists($param_hr->{'implicit_body_p_tag'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 1821 | ▶ | ? $param_hr->{'implicit_body_p_tag'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | : $WEBDYNE_COMPILE_IMPLICIT_BODY_P_TAG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # Now parse through the file, running eof at end as per HTML::TreeBuilder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # man page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1821 | $tree_or->parse($parse_cr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1821 | ▶ | if ($perl_sr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 658 | ▶ | my $html_perl_or=$tree_or->{'_html_perl_or'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tree_or->{'_html_perl_or'} || (return err('unable to locate __PERL__ node for raw perl source'))
MC/DC0%0/1
$tree_or->{'_html_perl_or'} || (return err('unable to locate __PERL__ node for raw perl source'))
$tree_or->{'_html_perl_or'}
Truth table50%1/2
A
A= $tree_or->{'_html_perl_or'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | return err('unable to locate __PERL__ node for raw perl source'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 658 | my $perl="\n".${$perl_sr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 658 | ▶ | $perl.=$/ unless $perl=~/(?:\r?\n|\r)$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 658 | $html_perl_or->attr('perl', $perl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # Close handler if anything goes wrong below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 1821 | ▶ | my $close_cr=sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 1821 | $tree_or->delete; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 1821 | undef $tree_or; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1821 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # Any errors ? Make sure clean-up before throwing error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1821 | ▶ | if (errstr()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | return err($close_cr->()) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | # So far so good. Close tree and file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 1821 | $tree_or->eof(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1821 | $html_fh->close(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # Set flag (tagname) if we have seen <api> or <htmx> tags and want to compact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # our tree to remove unneccessary <html><head><body> etc. since these | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # tags will never emit a full html page when used for real. Do here as lost | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # after elementify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1821 | my $compact_tag=$tree_or->{'_webdyne_compact'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1821 | 0 && debug("compact_tag: $compact_tag"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # Elementify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1821 | ▶ | $tree_or->elementify() || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | return $close_cr->(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # Now start iterating through the treebuilder object, creating | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # our own array tree structure. Do this in a separate method that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # is rentrant as the tree is descended | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | my %meta=( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 1821 | ▶ | manifest => $param_hr->{'no_manifest'} ? undef : [$html_cn] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1821 | ▶ | my $data_ar=$self->parse($tree_or, \%meta) || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->parse($tree_or, \%meta) || do {
return err(&$close_cr())
}
MC/DC0%0/2
$self->parse($tree_or, \%meta) || do {
return err(&$close_cr())
}
$self->parse($tree_or, \%meta)
do {
return err(&$close_cr())
}
Truth table33%1/3
A || B
A= $self->parse($tree_or, \%meta)B= do {
return err(&$close_cr())
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | return err($close_cr->()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1821 | 0 && debug("meta after parse %s", Dumper(\%meta)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # Now destroy the HTML::Treebuilder object, or else mem leak occurs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1821 | $close_cr->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # Meta block. Add any webdyne meta data to parse tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1821 | ▶ | my $head_ar=$self->find_node( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->find_node({'data_ar', $data_ar, 'tag', 'head'}) || (return err())
MC/DC0%0/1
$self->find_node({'data_ar', $data_ar, 'tag', 'head'}) || (return err())
$self->find_node({'data_ar', $data_ar, 'tag', 'head'})
Truth table50%1/2
A
A= $self->find_node({'data_ar', $data_ar, 'tag', 'head'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | data_ar => $data_ar, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | tag => 'head', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | }) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 1821 | ▶ | my $meta_ar=$self->find_node( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->find_node({'data_ar', $head_ar->[0], 'tag', 'meta', 'all_fg', 1}) || (return err())
MC/DC0%0/1
$self->find_node({'data_ar', $head_ar->[0], 'tag', 'meta', 'all_fg', 1}) || (return err())
$self->find_node({'data_ar', $head_ar->[0], 'tag', 'meta', 'all_fg', 1})
Truth table50%1/2
A
A= $self->find_node({'data_ar', $head_ar->[0], 'tag', 'meta', 'all_fg', 1})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | data_ar => $head_ar->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | tag => 'meta', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | all_fg => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | }) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 1821 | 0 && debug('meta_ar: %s', Dumper($meta_ar)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 1821 | foreach my $tag_ar (@{$meta_ar}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 3271 | ▶ | my $attr_hr=$tag_ar->[WEBDYNE_NODE_ATTR_IX] || next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tag_ar->[1] || (next)
MC/DC0%0/1
$tag_ar->[1] || (next)
$tag_ar->[1]
Truth table50%1/2
A
A= $tag_ar->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 3271 | 0 && debug('meta attr_hr: %s', Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 3271 | $attr_hr=$self->subst_attr(undef, $attr_hr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 3271 | 0 && debug('meta attr_hr post subst: %s', Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 3271 | ▶ | if ($attr_hr->{'name'}=~/^webdyne$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 39 | my @meta=split(/;/, $attr_hr->{'content'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 39 | 0 && debug('meta %s', Dumper(\@meta)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 39 | foreach my $meta (@meta) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 39 | my ($name, $value)=split(/[=:]/, $meta, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 39 | ▶ | defined($value) || ($value=1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # Eval any meta attrs like @{}, %{}.. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 39 | ▶ | my $hr=$self->subst_attr(undef, {$name => $value}) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->subst_attr(undef, {$name, $value}) || (return err())
MC/DC0%0/1
$self->subst_attr(undef, {$name, $value}) || (return err())
$self->subst_attr(undef, {$name, $value})
Truth table50%1/2
A
A= $self->subst_attr(undef, {$name, $value})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 39 | $meta{$name}=$hr->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 39 | ▶ | if ($name eq 'cache') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 21 | ▶ | $meta{'static'} ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$meta{"static"} ||= 1
MC/DC0%0/1
$meta{"static"} ||= 1
$meta{"static"}
Truth table50%1/2
A
A= $meta{"static"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # Do not want anymore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | $self->delete_node( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 39 | ▶ | data_ar => $data_ar, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | node_ar => $tag_ar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | }) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | elsif (ref($attr_hr->{'content'}) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 67 | ▶ | while (my($meta_key, $meta_value)=each %{$attr_hr->{'content'}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 142 | ▶ | if ($meta_key=~/^webdyne$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 37 | my @meta=split(/;/, $meta_value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 37 | 0 && debug('meta %s', Dumper(\@meta)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 37 | foreach my $meta (@meta) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 37 | my ($name, $value)=split(/[=:]/, $meta, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 37 | ▶ | defined($value) || ($value=1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 37 | $meta{$name}=$value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 37 | ▶ | if ($name eq 'cache') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 21 | ▶ | $meta{'static'} ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$meta{"static"} ||= 1
MC/DC0%0/1
$meta{"static"} ||= 1
$meta{"static"}
Truth table50%1/2
A
A= $meta{"static"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # And look for any static or cache tags found in start_html and noted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 1821 | foreach my $attr (qw(static cache handler sse ws require import)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 12747 | ▶ | if (my $value=$html_tiny_or->{"_${attr}"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 58 | $meta{$attr}=$value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 1821 | 0 && debug('final inode meta: %s', Dumper(\%meta)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # If <api> or <htmx) tag used in page compress down to just the <api>/<htmx> nodes and throw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | # everything else away. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 1821 | ▶ | if ($compact_tag) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # Find all the api nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 62 | my $api_ar=$self->find_node({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | data_ar => $data_ar, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | tag => $compact_tag, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | all_fg => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # And make a new data_ar structure to hold it, throwing everything else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # in the bin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 62 | $data_ar=[undef, undef, $api_ar]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # Construct final webdyne container | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 1821 | ▶ | my @container=(keys %meta ? \%meta : undef, $data_ar); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # Quit if user wants to see tree at this stage (stage0 | opt0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 1821 | ▶ | $param_hr->{'stage0'} && (return \@container); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | # Store meta information for this instance so that when perl_init (or code running under perl_init) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # runs it can access meta data via $self->meta(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 1574 | ▶ | $self->{'_meta_hr'}=\%meta if keys %meta; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 1574 | ▶ | if ((my $perl_ar=$meta{'perl'}) && !$param_hr->{'no_perl'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
my $perl_ar = $meta{"perl"} and not $param_hr->{"no_perl"}
MC/DC100%2/2
my $perl_ar = $meta{"perl"} and not $param_hr->{"no_perl"}
my $perl_ar = $meta{"perl"}
not $param_hr->{"no_perl"}
Truth table100%3/3
A and not(B)
A= my $perl_ar = $meta{"perl"}B= not $param_hr->{"no_perl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # This is inline __PERL__ perl. Must be executed before filter so any filters added by the __PERL__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # block are seen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 80 | my $perl_debug_ar=$meta{'perl_debug'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 80 | ▶ | $self->perl_init($perl_ar, $perl_debug_ar) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # Quit if user wants to see tree at this stage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 1574 | ▶ | $param_hr->{'stage1'} && (return \@container); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # Filter ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 1334 | my @filter=@{$meta{'webdynefilter'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 1334 | ▶ | unless (@filter) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 1332 | ▶ | my $filter=$self->{'_filter'} || $r->dir_config('WebDyneFilter'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'_filter'} || $r->dir_config('WebDyneFilter')
MC/DC0%0/2
$self->{'_filter'} || $r->dir_config('WebDyneFilter')
$self->{'_filter'}
$r->dir_config('WebDyneFilter')
Truth table33%1/3
A || B
A= $self->{'_filter'}B= $r->dir_config('WebDyneFilter')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 1332 | ▶ | @filter=split(/\s+/, $filter) if $filter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 1334 | 0 && debug('filter %s', Dumper(\@filter)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 1334 | ▶ | if ((@filter) && !$param_hr->{'no_filter'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@filter and not $param_hr->{"no_filter"}
MC/DC50%1/2
@filter and not $param_hr->{"no_filter"}
@filter
not $param_hr->{"no_filter"}
Truth table66%2/3
A and not(B)
A= @filterB= not $param_hr->{"no_filter"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 2 | local $SIG{'__DIE__'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | foreach my $filter (@filter) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | $filter=~s/::filter$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 2 | ▶ | eval("require $filter") || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | return err("unable to load filter $filter, " . lcfirst($@)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 2 | ▶ | UNIVERSAL::can($filter, 'filter') || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | return err("custom filter '$filter' does not seem to have a 'filter' method to call"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 2 | $filter.='::filter'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 2 | ▶ | $data_ar=$self->$filter($data_ar, \%meta) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->$filter($data_ar, \%meta) || (return err())
MC/DC0%0/1
$self->$filter($data_ar, \%meta) || (return err())
$self->$filter($data_ar, \%meta)
Truth table50%1/2
A
A= $self->$filter($data_ar, \%meta)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # Quit if user wants to see tree at this stage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 1334 | ▶ | $param_hr->{'stage2'} && (return \@container); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | # Optimise tree, first step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 1100 | ▶ | $data_ar=$self->optimise_one($data_ar) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->optimise_one($data_ar) || (return err())
MC/DC0%0/1
$self->optimise_one($data_ar) || (return err())
$self->optimise_one($data_ar)
Truth table50%1/2
A
A= $self->optimise_one($data_ar)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 1100 | $container[1]=$data_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | # Quit if user wants to see tree at this stage (stage3|opt1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 1100 | ▶ | ($param_hr->{'stage3'} || $param_hr->{'opt1'}) && (return \@container); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$param_hr->{"stage3"} or $param_hr->{"opt1"}
MC/DC50%1/2
$param_hr->{"stage3"} or $param_hr->{"opt1"}
$param_hr->{"stage3"}
$param_hr->{"opt1"}
Truth table66%2/3
A or B
A= $param_hr->{"stage3"}B= $param_hr->{"opt1"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | # Optimise tree, second step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 866 | ▶ | $data_ar=$self->optimise_two($data_ar) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->optimise_two($data_ar) || (return err())
MC/DC0%0/1
$self->optimise_two($data_ar) || (return err())
$self->optimise_two($data_ar)
Truth table50%1/2
A
A= $self->optimise_two($data_ar)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 866 | $container[1]=$data_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | # Quit if user wants to see tree at this stage (stage4|opt2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 866 | ▶ | ($param_hr->{'stage4'} || $param_hr->{'opt2'}) && (return \@container); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$param_hr->{"stage4"} or $param_hr->{"opt2"}
MC/DC50%1/2
$param_hr->{"stage4"} or $param_hr->{"opt2"}
$param_hr->{"stage4"}
$param_hr->{"opt2"}
Truth table66%2/3
A or B
A= $param_hr->{"stage4"}B= $param_hr->{"opt2"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # Is there any dynamic data ? If not, set meta html flag to indicate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # document is complete HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 632 | ▶ | unless (grep {ref($_)} @{$data_ar}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 180 | $meta{'html'}=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # Construct final webdyne container | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 632 | ▶ | @container=(keys %meta ? \%meta : undef, $data_ar); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # Quit if user wants to final container (stage5|final) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 632 | ▶ | $param_hr->{'stage5'} && (return \@container); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # Save compiled object. Can't store code based cache refs, will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # recreated anyway (when reloaded), so delete, save, then restore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 398 | my $cache_cr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 398 | ▶ | if (ref($meta{'cache'}) eq 'CODE') {$cache_cr=delete $meta{'cache'}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # Store to cache file if dest filename given | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 398 | ▶ | if ($dest_cn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | 0 && debug("attempting to cache to dest $dest_cn"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | local $SIG{'__DIE__'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 1 | ▶ | eval {Storable::lock_store(\@container, $dest_cn)} || do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # This used to be fatal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | #return err("error storing compiled $html_cn to dest $dest_cn, $@"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | # No more, just log warning and continue - no point crashing an otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | # perfectly good app because we can't write to a directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | $r->log_error( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | "error storing compiled $html_cn to dest $dest_cn, $@ - " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 'please ensure destination directory is writeable.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | unless $Package{'warn_write'}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | 0 && debug("caching FAILED to $dest_cn"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 397 | 0 && debug('no destination file for compile - not caching'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | # Put the cache code ref back again now we have finished storing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 398 | ▶ | $cache_cr && ($meta{'cache'}=$cache_cr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | # Work out the page compile time, log | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 398 | my $time_compile=sprintf('%0.4f', time()-$time); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | $meta{'time_compile_elapsed'}=$time_compile unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 398 | ▶ | $param_hr->{'no_timestamp'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | $meta{'time_compile'}=$time unless | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 398 | ▶ | $param_hr->{'no_timestamp'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 398 | 0 && debug("form $html_cn compile time $time_compile"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | # Destroy self | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 398 | undef $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | # Done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 398 | return \@container; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 30 | ▶ | sub compile_init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compile_init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | # Used to init package, move ugliness out of handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 30 | my $class=shift(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 30 | 0 && debug("in compile_init class $class"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | # Used to do some custom stuff here but now stub. Add anything wanted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | #*WebDyne::HTML::Tiny::start_html0=sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | # my ($self, $attr_hr)=@_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # keys %{$attr_hr} || ($attr_hr=$WEBDYNE_HTML_PARAM); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # my $html_attr=join(' ', map {qq($_="$attr_hr->{$_}")} keys %{$attr_hr}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # return $WEBDYNE_DTD . ($html_attr ? "<html $html_attr>" : '<html>'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | #}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | # All done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 30 | return \undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 1104 | ▶ | sub optimise_one { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
optimise_one: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # Optimise a data tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 1104 | my ($self, $data_ar)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # Debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 1104 | 0 && debug('optimise stage one'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | # Get CGI object and disable shortcut tags (e.g. start_html); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 1104 | ▶ | my $html_tiny_or=$self->{'_html_tiny_or'} || $self->html_tiny() || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$self->{'_html_tiny_or'} || $self->html_tiny || (return err('unable to get CGI object from self ref'))
$self->{"_html_tiny_or"} or $self->html_tiny
MC/DC0%0/2
$self->{'_html_tiny_or'} || $self->html_tiny || (return err('unable to get CGI object from self ref'))
$self->{"_html_tiny_or"}
$self->html_tiny
Truth table33%1/3
A or B
A= $self->{"_html_tiny_or"}B= $self->html_tiny
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | return err("unable to get CGI object from self ref"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 1104 | 0 && debug("CGI $html_tiny_or"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 1104 | $html_tiny_or->shortcut_disable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | # Recursive anon sub to do the render | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 12470 | ▶ | my $compile_cr=sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=28 SCAR=33.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | # Get self ref, node array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 12470 | my ($compile_cr, $data_ar)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # Only do if we have children, if we do a foreach over nonexistent child node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | # it will spring into existance as empty array ref, which we then have to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | # wastefully store | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 12470 | ▶ | if ($data_ar->[WEBDYNE_NODE_CHLD_IX]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | # Process sub nodes to get child html data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 8249 | foreach my $data_chld_ix (0..$#{$data_ar->[WEBDYNE_NODE_CHLD_IX]}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | # Get data child | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 14967 | my $data_chld_ar=$data_ar->[WEBDYNE_NODE_CHLD_IX][$data_chld_ix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 14967 | 0 && debug("data_chld_ar $data_chld_ar"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | # If ref, recursivly run through compile process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 14967 | ▶ | ref($data_chld_ar) && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | # Run through compile sub-process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 11366 | ▶ | my $data_chld_xv=$compile_cr->($compile_cr, $data_chld_ar) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$compile_cr($compile_cr, $data_chld_ar) || (return err())
MC/DC0%0/1
&$compile_cr($compile_cr, $data_chld_ar) || (return err())
&$compile_cr($compile_cr, $data_chld_ar)
Truth table50%1/2
A
A= &$compile_cr($compile_cr, $data_chld_ar)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 11366 | ▶ | if (ref($data_chld_xv) eq 'SCALAR') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 6771 | $data_chld_xv=${$data_chld_xv} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | # Replace in tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 11366 | $data_ar->[WEBDYNE_NODE_CHLD_IX][$data_chld_ix]=$data_chld_xv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | # Get this node tag and attrs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | my ($html_tag, $attr_hr)= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 12470 | @{$data_ar}[WEBDYNE_NODE_NAME_IX, WEBDYNE_NODE_ATTR_IX]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 12470 | 0 && debug("tag $html_tag, attr %s", Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | # Check to see if any of the attributes will require a subst to be carried out | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 12470 | my @subst_oper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | my $subst_fg=$data_ar->[WEBDYNE_NODE_SBST_IX] || delete $attr_hr->{'subst'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 12470 | ▶ | grep {$_=~/([\$@%!+*^])\{(\1?)(.*?)\2\}/ && push(@subst_oper, $1)} values %{$attr_hr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition55%5/9
$data_ar->[3] || delete $attr_hr->{'subst'} || grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/ and push @subst_oper, $1;} values %{$attr_hr;})
$data_ar->[3] or delete $attr_hr->{"subst"}
$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/ && push(@subst_oper, $1)
MC/DC33%1/3
$data_ar->[3] || delete $attr_hr->{'subst'} || grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/ and push @subst_oper, $1;} values %{$attr_hr;})
$data_ar->[3]
delete $attr_hr->{"subst"}
grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/ and push @subst_oper, $1;} values %{$attr_hr;})
MC/DC50%1/2
$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/ && push(@subst_oper, $1)
$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/
push(@subst_oper, $1)
Truth table50%2/4
A or B || C
A= $data_ar->[3]B= delete $attr_hr->{"subst"}C= grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/ and push @subst_oper, $1;} values %{$attr_hr;})
Truth table66%2/3
A && B
A= $_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/B= push(@subst_oper, $1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | # Do not subst comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 12470 | ▶ | ($html_tag=~/~comment$/) && ($subst_fg=undef); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | # If subst_fg present, means we must do a subst on attr vars. Flag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 12470 | ▶ | $subst_fg && ($data_ar->[WEBDYNE_NODE_SBST_IX]=1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | # A CGI tag can be marked static, means that we can pre-render it for efficieny | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 12470 | my $static_fg=$attr_hr->{'static'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 12470 | 0 && debug("tag $html_tag, static_fg: $static_fg, subst_fg: $subst_fg, subst_oper %s", Dumper(\@subst_oper)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | # If static, but subst requires an eval, we can do now *only* if @ or % tags though, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | # and some !'s that do not need request object etc. Cannot do on $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 12470 | ▶ | if ($static_fg && $subst_fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$static_fg and $subst_fg
MC/DC100%2/2
$static_fg and $subst_fg
$static_fg
$subst_fg
Truth table100%3/3
A and B
A= $static_fgB= $subst_fg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | # Cannot optimes subst values with ${value}, must do later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 81 | ▶ | (grep {$_ eq '$'} @subst_oper) && return $data_ar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | # Do it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 81 | ▶ | $attr_hr=$self->WebDyne::subst_attr(undef, $attr_hr) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->WebDyne::subst_attr(undef, $attr_hr) || (return err())
MC/DC0%0/1
$self->WebDyne::subst_attr(undef, $attr_hr) || (return err())
$self->WebDyne::subst_attr(undef, $attr_hr)
Truth table50%1/2
A
A= $self->WebDyne::subst_attr(undef, $attr_hr)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | # If not special WebDyne tag, see if we can render node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 12470 | ▶ | if ((!$CGI_TAG_WEBDYNE{$html_tag} && !$CGI_TAG_FORM{$html_tag} && !$subst_fg) || $static_fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
not $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_FORM{$html_tag} || $subst_fg or $static_fg
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_FORM{$html_tag} || $subst_fg
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} or $WebDyne::Compile::CGI_TAG_FORM{$html_tag}
MC/DC100%4/4
not $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_FORM{$html_tag} || $subst_fg or $static_fg
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag}
$WebDyne::Compile::CGI_TAG_FORM{$html_tag}
$subst_fg
$static_fg
Truth table85%6/7
not(A or B || C) or D
A= $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag}B= $WebDyne::Compile::CGI_TAG_FORM{$html_tag}C= $subst_fgD= $static_fg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | #if ((!$CGI_TAG_WEBDYNE{$html_tag} && !$subst_fg) || $static_fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | # Check all child nodes to see if ref or scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 10045 | 0 && debug("if 1"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | my $ref_fv=$data_ar->[WEBDYNE_NODE_CHLD_IX] && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 10045 | ▶ | grep {ref($_)} @{$data_ar->[WEBDYNE_NODE_CHLD_IX]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$data_ar->[2] && grep({ref $_;} @{$$data_ar[2];})
MC/DC100%2/2
$data_ar->[2] && grep({ref $_;} @{$$data_ar[2];})
$data_ar->[2]
grep({ref $_;} @{$$data_ar[2];})
Truth table100%3/3
A && B
A= $data_ar->[2]B= grep({ref $_;} @{$$data_ar[2];})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | # If all scalars (ie no refs found)t, we can simply pre render all child nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 10045 | 0 && debug("ref_fv: $ref_fv"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 10045 | ▶ | unless ($ref_fv) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | # Done with static tag, delete so not rendered | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 7095 | delete $attr_hr->{'static'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | # Special case. If WebDyne tag and static, render now via WebDyne. Experimental | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 7095 | ▶ | if ($CGI_TAG_WEBDYNE{$html_tag}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | # Render via WebDyne | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 27 | 0 && debug("about to render tag $html_tag, attr %s", Dumper($attr_hr)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 27 | ▶ | my $html_sr=$self->$html_tag($data_ar, $attr_hr) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->$html_tag($data_ar, $attr_hr) || (return err())
MC/DC0%0/1
$self->$html_tag($data_ar, $attr_hr) || (return err())
$self->$html_tag($data_ar, $attr_hr)
Truth table50%1/2
A
A= $self->$html_tag($data_ar, $attr_hr)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 27 | 0 && debug("html *$html_sr*, *${$html_sr}*"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 27 | return $html_sr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 7068 | 0 && debug('not CGI_TAG_WEBDYNE') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # Wrap up in our HTML tag. Do in eval so we can catch errors from invalid tags etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 7068 | ▶ | my @data_child=$data_ar->[WEBDYNE_NODE_CHLD_IX] ? @{$data_ar->[WEBDYNE_NODE_CHLD_IX]} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 7068 | 0 && debug("about to call $html_tag with attr_hr:%s, data_child: %s", Dumper($attr_hr, \@data_child)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 7068 | ▶ | my $html=eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$attr_hr = undef unless keys %{$attr_hr;};
if ($html_tiny_or->can($html_tag)) {
'???';
$html_tiny_or->$html_tag(grep({$_;} $attr_hr, join(undef, @data_child)));
}
else {
'???';
$html_tiny_or->tag($html_tag, grep({$_;} $attr_hr, join(undef, @data_child)));
}
}
} || (return errsubst("CGI tag '<$html_tag>': %s", $@ || sprintf("undefined error rendering tag '${html_tag}', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child))))
MC/DC0%0/1
eval {
do {
$attr_hr = undef unless keys %{$attr_hr;};
if ($html_tiny_or->can($html_tag)) {
'???';
$html_tiny_or->$html_tag(grep({$_;} $attr_hr, join(undef, @data_child)));
}
else {
'???';
$html_tiny_or->tag($html_tag, grep({$_;} $attr_hr, join(undef, @data_child)));
}
}
} || (return errsubst("CGI tag '<$html_tag>': %s", $@ || sprintf("undefined error rendering tag '${html_tag}', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child))))
eval {
do {
$attr_hr = undef unless keys %{$attr_hr;};
if ($html_tiny_or->can($html_tag)) {
'???';
$html_tiny_or->$html_tag(grep({$_;} $attr_hr, join(undef, @data_child)));
}
else {
'???';
$html_tiny_or->tag($html_tag, grep({$_;} $attr_hr, join(undef, @data_child)));
}
}
}
Truth table50%1/2
A
A= eval {
do {
$attr_hr = undef unless keys %{$attr_hr;};
if ($html_tiny_or->can($html_tag)) {
'???';
$html_tiny_or->$html_tag(grep({$_;} $attr_hr, join(undef, @data_child)));
}
else {
'???';
$html_tiny_or->tag($html_tag, grep({$_;} $attr_hr, join(undef, @data_child)));
}
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 7068 | ▶ | $attr_hr=undef unless keys %{$attr_hr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 7068 | ▶ | if ($html_tiny_or->can($html_tag)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 7059 | 0 && debug("calling HTML::Tiny->$html_tag directly to render"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 7059 | $html_tiny_or->$html_tag(grep {$_} $attr_hr, join(undef, @data_child)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 9 | 0 && debug("calling HTML::Tiny->tag($html_tag) to render"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 9 | ▶ | $html_tiny_or->tag($html_tag, grep {$_} $attr_hr, join(undef, @data_child)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$@ || sprintf("undefined error rendering tag '${html_tag}', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child))
MC/DC0%0/2
$@ || sprintf("undefined error rendering tag '${html_tag}', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child))
$@
sprintf("undefined error rendering tag '${html_tag}', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child))
Truth table0%0/3
A || B
A= $@B= sprintf("undefined error rendering tag '${html_tag}', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | # Older attempts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | #$html_tiny_or->$html_tag(grep {$_} $attr_hr || {}, join(undef, @data_child)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | #$html_tiny_or->$html_tag($attr_hr || {}, join(undef, grep {$_} @data_child)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | } || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | # Use errsubst as CGI may have DIEd during eval and be caught by WebDyne SIG handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | return errsubst( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | "CGI tag '<$html_tag>': %s", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | $@ || sprintf("undefined error rendering tag '$html_tag', attr_hr:%s, data_child:%s", Dumper($attr_hr, \@data_child)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | # Debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | #debug("html *$html*"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | # Done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 7068 | return \$html; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 2425 | 0 && debug('fell through node render, no webdyne, subst tags etc.'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | # Return current node, perhaps now somewhat optimised | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 5375 | $data_ar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 1104 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | # Push data block onto stack as error hint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 1104 | push @{$self->{'_data_ar_err'}}, $data_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | # Run it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 1104 | ▶ | $data_ar=$compile_cr->($compile_cr, $data_ar) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$compile_cr($compile_cr, $data_ar) || (return err())
MC/DC0%0/1
&$compile_cr($compile_cr, $data_ar) || (return err())
&$compile_cr($compile_cr, $data_ar)
Truth table50%1/2
A
A= &$compile_cr($compile_cr, $data_ar)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | # No error, pop error hint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 1104 | pop @{$self->{'_data_ar_err'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | # Re-enable shortcuts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 1104 | $html_tiny_or->shortcut_enable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | # If scalar ref returned it is all HTML - return as plain scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 1104 | ▶ | if (ref($data_ar) eq 'SCALAR') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 324 | $data_ar=${$data_ar} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # Done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 1104 | return $data_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 870 | ▶ | sub optimise_two { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
optimise_two: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | # Optimise a data tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 870 | my ($self, $data_ar)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | # Debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 870 | 0 && debug('optimise stage two'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | # Get CGI object and turn off shortcuts like start_html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 870 | ▶ | my $html_tiny_or=$self->{'_html_tiny_or'} || $self->html_tiny() || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$self->{'_html_tiny_or'} || $self->html_tiny || (return err('unable to get CGI object from self ref'))
$self->{"_html_tiny_or"} or $self->html_tiny
MC/DC0%0/2
$self->{'_html_tiny_or'} || $self->html_tiny || (return err('unable to get CGI object from self ref'))
$self->{"_html_tiny_or"}
$self->html_tiny
Truth table33%1/3
A or B
A= $self->{"_html_tiny_or"}B= $self->html_tiny
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | return err("unable to get CGI object from self ref"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 870 | $html_tiny_or->shortcut_disable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | # Recursive anon sub to do the render | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 4255 | ▶ | my $compile_cr=sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=42 SCAR=40.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | # Get self ref, node array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 4255 | my ($compile_cr, $data_ar, $data_uppr_ar)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | # Only do if we have children, if do a foreach over nonexistent child node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | # it will spring into existance as empty array ref, which we then have to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | # wastefully store | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 4255 | ▶ | if ($data_ar->[WEBDYNE_NODE_CHLD_IX]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | # Process sub nodes to get child html data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | my @data_child_ar=$data_ar->[WEBDYNE_NODE_CHLD_IX] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 3189 | ▶ | @{$data_ar->[WEBDYNE_NODE_CHLD_IX]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 3189 | foreach my $data_chld_ar (@data_child_ar) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | # Debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | #debug("found child node $data_chld_ar"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | # If ref, run through compile process recursively | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 6110 | ▶ | ref($data_chld_ar) && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | # Run through compile sub-process | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 3635 | ▶ | $data_ar=$compile_cr->($compile_cr, $data_chld_ar, $data_ar) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
&$compile_cr($compile_cr, $data_chld_ar, $data_ar) || (return err())
MC/DC0%0/1
&$compile_cr($compile_cr, $data_chld_ar, $data_ar) || (return err())
&$compile_cr($compile_cr, $data_chld_ar, $data_ar)
Truth table50%1/2
A
A= &$compile_cr($compile_cr, $data_chld_ar, $data_ar)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # Get this tag and attrs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | my ($html_tag, $attr_hr)= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 4255 | @{$data_ar}[WEBDYNE_NODE_NAME_IX, WEBDYNE_NODE_ATTR_IX]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 4255 | 0 && debug("tag $html_tag"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | # Check if this tag attributes will need substitution (eg ${foo}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | my $subst_fg=$data_ar->[WEBDYNE_NODE_SBST_IX] || delete $attr_hr->{'subst'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 4255 | ▶ | grep {$_=~/([\$@%!+*^])\{(\1?)(.*?)\2\}/so} values %{$attr_hr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$data_ar->[3] || delete $attr_hr->{'subst'} || grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/so;} values %{$attr_hr;})
$data_ar->[3] or delete $attr_hr->{"subst"}
MC/DC33%1/3
$data_ar->[3] || delete $attr_hr->{'subst'} || grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/so;} values %{$attr_hr;})
$data_ar->[3]
delete $attr_hr->{"subst"}
grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/so;} values %{$attr_hr;})
Truth table50%2/4
A or B || C
A= $data_ar->[3]B= delete $attr_hr->{"subst"}C= grep({$_ =~ /([\$\@%!+*^])\{(\1?)(.*?)\2\}/so;} values %{$attr_hr;})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | # If subst_fg present, means we must do a subst on attr vars. Flag, also get static flag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 4255 | ▶ | $subst_fg && ($data_ar->[WEBDYNE_NODE_SBST_IX]=1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 4255 | my $static_fg=delete $attr_hr->{'static'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | # If not special WebDyne tag, and no dynamic params we can render this node into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | # its final HTML format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 4255 | ▶ | if (!$CGI_TAG_WEBDYNE{$html_tag} && !$CGI_TAG_IMPLICIT{$html_tag} && $data_uppr_ar && !$subst_fg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%9/9
not $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_IMPLICIT{$html_tag} and $data_uppr_ar and not $subst_fg
not $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_IMPLICIT{$html_tag} and $data_uppr_ar
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_IMPLICIT{$html_tag}
MC/DC100%4/4
not $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} || $WebDyne::Compile::CGI_TAG_IMPLICIT{$html_tag} and $data_uppr_ar and not $subst_fg
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag}
$WebDyne::Compile::CGI_TAG_IMPLICIT{$html_tag}
$data_uppr_ar
not $subst_fg
Truth table100%5/5
not(A || B) and C and not(D)
A= $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag}B= $WebDyne::Compile::CGI_TAG_IMPLICIT{$html_tag}C= $data_uppr_arD= not $subst_fg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | # Get nodes into array now, removes risk of iterating over shifting ground | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 1722 | 0 && debug("compile_cr: if 1"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | my @data_child_ar=$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 1722 | ▶ | @{$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | # Get uppr node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 1722 | foreach my $data_chld_ix (0..$#data_child_ar) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | # Get node, skip unless ref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 5256 | my $data_chld_ar=$data_child_ar[$data_chld_ix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 5256 | ▶ | ref($data_chld_ar) || next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | # Debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | #debug("looking at node $data_chld_ix, $data_chld_ar vs $data_ar"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | # Skip unless eq us | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 2983 | ▶ | next unless ($data_chld_ar eq $data_ar); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | # Get start and end tag methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 1722 | my ($html_tag_start, $html_tag_end)= | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | ("start_${html_tag}", "end_${html_tag}"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | # Translate tags into HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | my ($html_start, $html_end)=map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 1722 | 0 && debug("render tag $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 3444 | ▶ | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
} || (return errsubst("CGI tag '<$_>' error- %s", $@ || "undefined error rendering tag '${_}'"))
MC/DC0%0/1
eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
} || (return errsubst("CGI tag '<$_>' error- %s", $@ || "undefined error rendering tag '${_}'"))
eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
}
Truth table50%1/2
A
A= eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 3444 | ▶ | $html_tiny_or->$_(grep {$_} $attr_hr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$@ || "undefined error rendering tag '${_}'"
MC/DC0%0/1
$@ || "undefined error rendering tag '${_}'"
$@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | # Use errsubst as CGI may have DIEd during eval and be caught by WebDyne SIG handler | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | return errsubst( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | "CGI tag '<$_>' error- %s", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | $@ || "undefined error rendering tag '$_'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } ($html_tag_start, $html_tag_end); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | # Splice start and end tags for this HTML into appropriate place | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 1722 | splice @{$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX]}, $data_chld_ix, 1, grep {$_} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | $html_start, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | (WEBDYNE_HTML_NEWLINE && "\n"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 1722 | @{$data_ar->[WEBDYNE_NODE_CHLD_IX]}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | (WEBDYNE_HTML_NEWLINE && "\n"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | $html_end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | # Done, no need to iterate any more | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 1722 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | # Concatenate all non ref values in the parent. Var to hold results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 1722 | my @data_uppr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | # Repopulate data child array, as probably changed in above foreach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | # block. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | @data_child_ar=$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 1722 | ▶ | @{$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | #@data_child_ar=@{$data_uppr_ar->[$WEBDYNE_NODE_CHLD_IX]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | # Begin concatenation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 1722 | foreach my $data_chld_ix (0..$#data_child_ar) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | # Get child | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 14168 | my $data_chld_ar=$data_child_ar[$data_chld_ix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | # Can we concatenate with above node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 14168 | ▶ | if (@data_uppr && !ref($data_chld_ar) && !ref($data_uppr[$#data_uppr])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
@data_uppr and not ref $data_chld_ar and not ref $data_uppr[$#data_uppr]
@data_uppr and not ref $data_chld_ar
MC/DC100%3/3
@data_uppr and not ref $data_chld_ar and not ref $data_uppr[$#data_uppr]
@data_uppr
not ref $data_chld_ar
not ref $data_uppr[$#data_uppr]
Truth table100%4/4
A and not(B) and not(C)
A= @data_upprB= not ref $data_chld_arC= not ref $data_uppr[$#data_uppr]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | # Yes, concatentate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 3179 | $data_uppr[$#data_uppr].=$data_chld_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | # No, push onto new data_uppr array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 10989 | push @data_uppr, $data_chld_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | # Replace with new optimised array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 1722 | $data_uppr_ar->[WEBDYNE_NODE_CHLD_IX]=\@data_uppr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | ▶ | elsif ($CGI_TAG_WEBDYNE{$html_tag} && $data_uppr_ar && $static_fg) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} and $data_uppr_ar and $static_fg
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} and $data_uppr_ar
MC/DC0%0/3
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag} and $data_uppr_ar and $static_fg
$WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag}
$data_uppr_ar
$static_fg
Truth table50%2/4
A and B and C
A= $WebDyne::Compile::CGI_TAG_WEBDYNE{$html_tag}B= $data_uppr_arC= $static_fg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | # Now render to make HTML and modify the data arrat above us with the rendered code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | 0 && debug("compile_cr: if 2"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | ▶ | my $html_sr=$self->render_data_ar( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->render_data_ar('data', [$data_ar]) || (return err())
MC/DC0%0/1
$self->render_data_ar('data', [$data_ar]) || (return err())
$self->render_data_ar('data', [$data_ar])
Truth table0%0/2
A
A= $self->render_data_ar('data', [$data_ar])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | data => [$data_ar], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | ) || return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | my @data_child_ar=$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | ▶ | @{$data_uppr_ar->[WEBDYNE_NODE_CHLD_IX]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | foreach my $ix (0..$#data_child_ar) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | ▶ | if ($data_uppr_ar->[WEBDYNE_NODE_CHLD_IX][$ix] eq $data_ar) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | $data_uppr_ar->[WEBDYNE_NODE_CHLD_IX][$ix]=${$html_sr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | ▶ | elsif (!$data_uppr_ar && $html_tag) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not $data_uppr_ar and $html_tag
MC/DC100%2/2
not $data_uppr_ar and $html_tag
not $data_uppr_ar
$html_tag
Truth table100%3/3
not(A) and B
A= not $data_uppr_arB= $html_tag
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | # Must be at top node, as nothing above us, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | # get start and end tag methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 590 | 0 && debug("compile_cr: if 3"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 590 | my ($html_tag_start, $html_tag_end)= | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | ("start_${html_tag}", "end_${html_tag}"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | # Get resulting start and ending HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | my ($html_start, $html_end)=map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 590 | 0 && debug("render tag $_"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 1180 | ▶ | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
} || (return errsubst("CGI tag '<$_>': %s", $@ || "undefined error rendering tag '${_}'"))
MC/DC0%0/1
eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
} || (return errsubst("CGI tag '<$_>': %s", $@ || "undefined error rendering tag '${_}'"))
eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
}
Truth table50%1/2
A
A= eval {
do {
$html_tiny_or->$_(grep({$_;} $attr_hr))
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 1180 | ▶ | $html_tiny_or->$_(grep {$_} $attr_hr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$@ || "undefined error rendering tag '${_}'"
MC/DC0%0/1
$@ || "undefined error rendering tag '${_}'"
$@
Truth table0%0/2
A
A= $@
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | return errsubst( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | "CGI tag '<$_>': %s", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | $@ || "undefined error rendering tag '$_'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | #return err("$@" || "no html returned from tag $_") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } ($html_tag_start, $html_tag_end); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | my @data_child_ar=$data_ar->[WEBDYNE_NODE_CHLD_IX] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 590 | ▶ | @{$data_ar->[WEBDYNE_NODE_CHLD_IX]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | # Place start and end tags for this HTML into appropriate place | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 590 | my @data=( grep {$_} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | $html_start, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | (WEBDYNE_HTML_NEWLINE && "\n"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | @data_child_ar, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | (WEBDYNE_HTML_NEWLINE && "\n"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | $html_end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | # Concatenate all non ref vals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | 590 | my @data_new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 590 | foreach my $data_chld_ix (0..$#data) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 4238 | ▶ | if ($data_chld_ix && !ref($data[$data_chld_ix]) && !(ref($data[$data_chld_ix-1]))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$data_chld_ix and not ref $data[$data_chld_ix] and not ref $data[$data_chld_ix - 1]
$data_chld_ix and not ref $data[$data_chld_ix]
MC/DC100%3/3
$data_chld_ix and not ref $data[$data_chld_ix] and not ref $data[$data_chld_ix - 1]
$data_chld_ix
not ref $data[$data_chld_ix]
not ref $data[$data_chld_ix - 1]
Truth table100%4/4
A and not(B) and not(C)
A= $data_chld_ixB= not ref $data[$data_chld_ix]C= not ref $data[$data_chld_ix - 1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 1167 | $data_new[$#data_new].=$data[$data_chld_ix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 3071 | push @data_new, $data[$data_chld_ix] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | # Return completed array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 590 | $data_uppr_ar=\@data_new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | ▶ | elsif (!$data_uppr_ar && !$html_tag) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$data_uppr_ar || $html_tag
MC/DC50%1/2
$data_uppr_ar || $html_tag
$data_uppr_ar
$html_tag
Truth table66%2/3
A || B
A= $data_uppr_arB= $html_tag
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | # Special case generated by page with <api> tags, means we're not going to wrap in <html> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 30 | $data_uppr_ar=$data_ar->[WEBDYNE_NODE_CHLD_IX]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | # Return current node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | 4255 | return $data_uppr_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 870 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | # Push data block onto error hint stack in case of compile error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 870 | push @{$self->{'_data_ar_err'}}, $data_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | # Run it, return whatever it does, allowing for the special case that first stage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | # optimisation found no special tags, and precompiled the whole array into a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | # single HTML string. In which case return as array ref to allow for correct storage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | # and rendering. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 870 | my $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 870 | ▶ | if (ref($data_ar)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 620 | ▶ | $ret=$compile_cr->($compile_cr, $data_ar, undef) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
&$compile_cr($compile_cr, $data_ar, undef) || err()
MC/DC0%0/2
&$compile_cr($compile_cr, $data_ar, undef) || err()
&$compile_cr($compile_cr, $data_ar, undef)
err()
Truth table33%1/3
A || B
A= &$compile_cr($compile_cr, $data_ar, undef)B= err()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | err() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 250 | $ret=[$data_ar]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | # No errors, pop error hint stack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 870 | pop @{$self->{'_data_ar_err'}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | # Re-enable shortcuts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 870 | $html_tiny_or->shortcut_enable(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | # And return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 870 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 21285 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=12 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | # A recusively called method to parse a HTML::Treebuilder tree. content is an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | # array ref of the HTML entity contents, return custom array tree from that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | # structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 21285 | my ($self, $html_or, $meta_hr)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 21285 | my ($line_no, $line_no_tag_end)=@{$html_or}{'_line_no', '_line_no_tag_end'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 21285 | my $html_fn_sr=\$meta_hr->{'manifest'}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 21285 | 0 && debug("parse $self, $html_or line_no $line_no line_no_tag_end $line_no_tag_end"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | # Create array to hold this data node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 21285 | my @data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 21285 | @data[ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | WEBDYNE_NODE_NAME_IX, # Tag Name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | WEBDYNE_NODE_ATTR_IX, # Attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | WEBDYNE_NODE_CHLD_IX, # Child nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | WEBDYNE_NODE_SBST_IX, # Substitution Required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | WEBDYNE_NODE_LINE_IX, # Source Line Number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | WEBDYNE_NODE_LINE_TAG_END_IX, # What line this tag ends on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | WEBDYNE_NODE_SRCE_IX # Source file name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | ]=( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | #undef, undef, undef, undef, $line_no, $line_no_tag_end, $meta_hr->{'manifest'}[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | undef, undef, undef, undef, $line_no, $line_no_tag_end, $html_fn_sr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | # Get tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 21285 | my $html_tag=$html_or->tag(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | # Get tag attr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 21285 | ▶ | if (my %attr=map {$_ => $html_or->{$_}} (grep {!/^_/} keys %{$html_or})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | # Save tagm attr into node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | #@data[$WEBDYNE_NODE_NAME_IX, $WEBDYNE_NODE_ATTR_IX]=($html_tag, \%attr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | # Is this the inline perl __PERL__ block ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 10707 | ▶ | if ($html_or->{'_code'} && $attr{'perl'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$html_or->{"_code"} and $attr{"perl"}
MC/DC50%1/2
$html_or->{"_code"} and $attr{"perl"}
$html_or->{"_code"}
$attr{"perl"}
Truth table66%2/3
A and B
A= $html_or->{"_code"}B= $attr{"perl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 658 | push @{$meta_hr->{'perl'}}, \$attr{'perl'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 658 | push @{$meta_hr->{'perl_debug'}}, [$line_no, $html_fn_sr]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 10049 | @data[WEBDYNE_NODE_NAME_IX, WEBDYNE_NODE_ATTR_IX]=($html_tag, \%attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | # No attr, just save tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 10578 | $data[WEBDYNE_NODE_NAME_IX]=$html_tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | # Child nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 21285 | my @html_child=@{$html_or->content()}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | # Get child, parse down the tree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 21285 | foreach my $html_child_or (@html_child) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 26715 | 0 && debug("html_child_or $html_child_or"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | # Ref is a sub-tag, non ref is plain text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 26715 | ▶ | if (ref($html_child_or)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | # Sub tag. Recurse down tree, updating to nearest line number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 19464 | $line_no=$html_child_or->{'_line_no'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 19464 | ▶ | my $data_ar=$self->parse($html_child_or, $meta_hr) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->parse($html_child_or, $meta_hr) || (return err())
MC/DC0%0/1
$self->parse($html_child_or, $meta_hr) || (return err())
$self->parse($html_child_or, $meta_hr)
Truth table50%1/2
A
A= $self->parse($html_child_or, $meta_hr)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | return err(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | # If no node name returned is not an error, just a no-op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 19464 | ▶ | if ($data_ar->[WEBDYNE_NODE_NAME_IX]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 18806 | push @{$data[WEBDYNE_NODE_CHLD_IX]}, $data_ar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | # Node is just plain text. Used to not insert empty children, but this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | # stuffed up <pre> sections that use \n for spacing/formatting. Now we | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | # are more careful | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 7251 | ▶ | push(@{$data[WEBDYNE_NODE_CHLD_IX]}, $html_child_or) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$html_child_or =~ /^\s*$/ and $html_tag ne "pre" and $html_tag ne "textarea" and not $WebDyne::Compile::WEBDYNE_COMPILE_NO_SPACE_COMPACTING
$html_child_or =~ /^\s*$/ and $html_tag ne "pre" and $html_tag ne "textarea"
$html_child_or =~ /^\s*$/ and $html_tag ne "pre"
MC/DC50%2/4
$html_child_or =~ /^\s*$/ and $html_tag ne "pre" and $html_tag ne "textarea" and not $WebDyne::Compile::WEBDYNE_COMPILE_NO_SPACE_COMPACTING
$html_child_or =~ /^\s*$/
$html_tag ne "pre"
$html_tag ne "textarea"
not $WebDyne::Compile::WEBDYNE_COMPILE_NO_SPACE_COMPACTING
Truth table60%3/5
A and B and C and not(D)
A= $html_child_or =~ /^\s*$/B= $html_tag ne "pre"C= $html_tag ne "textarea"D= not $WebDyne::Compile::WEBDYNE_COMPILE_NO_SPACE_COMPACTING
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | unless ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | $html_child_or=~/^\s*$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | ($html_tag ne 'pre') && ($html_tag ne 'textarea') && !$WEBDYNE_COMPILE_NO_SPACE_COMPACTING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | # All done, return data node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 21285 | return \@data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||