| 1 | package Web::Scaffold; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | #use diagnostics; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use POSIX; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use Fcntl qw(:flock); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | $VERSION = do { my @r = (q$Revision: 0.15 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | my @defaults = ( | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # directory path for 'html pages' relative to the html root | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # i.e. public_html/ defaults to: | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||||||||||||
| 16 | pagedir => '../pages', | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | # directory path for 'javascript libraries' relative to html root | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # defaults to: | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | javascript => 'lib', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | # no search conditions for building the site map. Each | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # element is evaluated as a perl match condition in the | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # context of m/element/. Include page names, extensions, etc... | ||||||||||||||||||||||||||||||||||||||||||
| 26 | # | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # [OPTIONAL] | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | nosearch => [ 'pdf' ], | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # Directory path for 'sitemap' page generation relative to the | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # html root. This directory must be WRITABLE by the web server. | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # NOTE: link the file 'sitemapdir'/sitemaplxml to the | ||||||||||||||||||||||||||||||||||||||||||
| 36 | # appropriate location in your web directory. | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # The sitemap.xml file will be generated and updated ONLY if | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # the 'sitemapdir' key is present in this configuration file. | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # The sitemap page will auto update if you modify pages in | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # 'pagedir' or in the 'autocheck' list below. If you modify | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # static pages elsewhere in the web directory tree that are | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # not listed in 'autocheck', you must DELETE the sitemap.xml | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # file to force an update. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | # | ||||||||||||||||||||||||||||||||||||||||||
| 47 | # [OPTIONAL] | ||||||||||||||||||||||||||||||||||||||||||
| 48 | # | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # sitemapdir => '../ws_sitemap', | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # Directories to autocheck for sitemap update. | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # you can list BOTH directories and individual files | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # here relative to the web root. The 'sitemapdir' and | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # 'pagedir' are always checked and do not need to be | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # listed here. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # autocheck => ['docs'], | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | # site map <changefreq> hint | ||||||||||||||||||||||||||||||||||||||||||
| 60 | # | ||||||||||||||||||||||||||||||||||||||||||
| 61 | # defaults to: | ||||||||||||||||||||||||||||||||||||||||||
| 62 | # | ||||||||||||||||||||||||||||||||||||||||||
| 63 | changefreq => 'monthly', | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | # font family used throughout the document | ||||||||||||||||||||||||||||||||||||||||||
| 66 | # | ||||||||||||||||||||||||||||||||||||||||||
| 67 | face => 'VERANDA,ARIAL,HELVETICA,SAN-SERIF', | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | # background color of the web page | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # this can be a web color like 'white' or number '#ffffff' | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # | ||||||||||||||||||||||||||||||||||||||||||
| 72 | backcolor => 'white', | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | # Menu specifications | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # | ||||||||||||||||||||||||||||||||||||||||||
| 76 | barcolor => 'red', | ||||||||||||||||||||||||||||||||||||||||||
| 77 | menudrop => '55', # drop down position | ||||||||||||||||||||||||||||||||||||||||||
| 78 | menuwidth => '100px', # width of menu item | ||||||||||||||||||||||||||||||||||||||||||
| 79 | pagewidth => '620px', # recommended | ||||||||||||||||||||||||||||||||||||||||||
| 80 | # menu font specifications | ||||||||||||||||||||||||||||||||||||||||||
| 81 | menucolor => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 82 | menuhot => 'yellow', # mouse over | ||||||||||||||||||||||||||||||||||||||||||
| 83 | menucold => 'white', # page selected | ||||||||||||||||||||||||||||||||||||||||||
| 84 | menustyle => 'normal', # bold, italic | ||||||||||||||||||||||||||||||||||||||||||
| 85 | menusize => '13px', # font points or pixels | ||||||||||||||||||||||||||||||||||||||||||
| 86 | sepcolor => 'black', # separator color | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | # Page link font specifications | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # | ||||||||||||||||||||||||||||||||||||||||||
| 90 | linkcolor => 'blue', | ||||||||||||||||||||||||||||||||||||||||||
| 91 | linkhot => 'green', | ||||||||||||||||||||||||||||||||||||||||||
| 92 | linkstyle => 'normal', # bold, italic | ||||||||||||||||||||||||||||||||||||||||||
| 93 | linksize => '13px', # font points or pixels | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | # Page Text font specifications | ||||||||||||||||||||||||||||||||||||||||||
| 96 | # | ||||||||||||||||||||||||||||||||||||||||||
| 97 | fontcolor => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 98 | fontstyle => 'normal', | ||||||||||||||||||||||||||||||||||||||||||
| 99 | fontsize => '13px', | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | # Heading font specifications | ||||||||||||||||||||||||||||||||||||||||||
| 102 | # | ||||||||||||||||||||||||||||||||||||||||||
| 103 | headcolor => 'black', | ||||||||||||||||||||||||||||||||||||||||||
| 104 | headstyle => 'bold', # normal, italic | ||||||||||||||||||||||||||||||||||||||||||
| 105 | headsize => '16px', | ||||||||||||||||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | # set default values where specs are missing | ||||||||||||||||||||||||||||||||||||||||||
| 109 | # | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # return most recent mtime from pagedir or autocheck list if sitemap is enabled | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | ▶ | sub checkspecs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkspecs: called CC=13 SCAR=37.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | my $specs = shift; | |||||||||||||||||||||||||||||||||||||||||
| 114 | # set defaults | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | ▶ | for (my $i=0; $i < @defaults; $i+=2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | $specs->{$defaults[$i]} = $defaults[$i+1] | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 26 | ▶ | unless exists $specs->{$defaults[$i]}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | foreach('pagedir', 'javascript', 'sitemapdir') { | |||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | ▶ | if (exists $specs->{$_}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | ▶ | $specs->{$_} = $' if $specs->{$_} =~ m|^/|; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | $specs->{$_} .= '/' unless $specs->{$_} =~ m|/$|; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | ▶ | if (exists $specs->{sitemapdir}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $mtime = (stat($specs->{pagedir}))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if (exists $specs->{autocheck} && ref $specs->{autocheck}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $specs->{"autocheck"} and ref $specs->{"autocheck"}
MC/DC0%0/2
exists $specs->{"autocheck"} and ref $specs->{"autocheck"}
exists $specs->{"autocheck"}
ref $specs->{"autocheck"}
Truth table0%0/3
A and B
A= exists $specs->{"autocheck"}B= ref $specs->{"autocheck"}
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | foreach (@{$specs->{autocheck}}) { | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | $_ = $' if $_ =~ m|^/|; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $t = (stat($_))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | $mtime = $t if $t > $mtime; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return $mtime; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | # generate the style library | ||||||||||||||||||||||||||||||||||||||||||
| 139 | # | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # input: pointer to %specs | ||||||||||||||||||||||||||||||||||||||||||
| 141 | # number of columns | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | sub stylegen { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stylegen: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | my($specs,$cols) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | $cols = 1 unless $cols; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | # | ||||||||||||||||||||||||||||||||||||||||||
| 146 | # .mhs menuHeadStyle | ||||||||||||||||||||||||||||||||||||||||||
| 147 | # .dropdown drop down style | ||||||||||||||||||||||||||||||||||||||||||
| 148 | # #mh menuHead | ||||||||||||||||||||||||||||||||||||||||||
| 149 | # A.B Basic link | ||||||||||||||||||||||||||||||||||||||||||
| 150 | # A.B:hover Basic link mouseOVER | ||||||||||||||||||||||||||||||||||||||||||
| 151 | # A.NU meNU link | ||||||||||||||||||||||||||||||||||||||||||
| 152 | # A.NU:hover meNU link mouseOVER | ||||||||||||||||||||||||||||||||||||||||||
| 153 | # A.CP menu link Current Page | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # | ||||||||||||||||||||||||||||||||||||||||||
| 155 | # FONT.NU meNU font | ||||||||||||||||||||||||||||||||||||||||||
| 156 | # TD.NU meNU font | ||||||||||||||||||||||||||||||||||||||||||
| 157 | # TD.S Separator font | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # .PT Page Text | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # .HT Heading Text | ||||||||||||||||||||||||||||||||||||||||||
| 160 | # | ||||||||||||||||||||||||||||||||||||||||||
| 161 | my $styles = q|<style type="text/css"> | ||||||||||||||||||||||||||||||||||||||||||
| 162 | .mhs { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | background-color: |. $specs->{barcolor} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | .dropdown { | ||||||||||||||||||||||||||||||||||||||||||
| 166 | background-color: |. $specs->{barcolor} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 167 | padding: 2px; | ||||||||||||||||||||||||||||||||||||||||||
| 168 | border: solid 1px |. $specs->{sepcolor} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | #mh { | ||||||||||||||||||||||||||||||||||||||||||
| 171 | position: relative; | ||||||||||||||||||||||||||||||||||||||||||
| 172 | z-index: 50; | ||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | A.B { | ||||||||||||||||||||||||||||||||||||||||||
| 175 | color: |. $specs->{linkcolor} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 176 | background: transparent; | ||||||||||||||||||||||||||||||||||||||||||
| 177 | font-family: |. $specs->{face} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 178 | font-weight: |. $specs->{linkstyle} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 179 | font-size: |. $specs->{linksize} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 180 | text-decoration: underline; | ||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | A.B:hover { | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | color: |. $specs->{linkhot} .q|; | |||||||||||||||||||||||||||||||||||||||||
| 184 | }|; | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | my $tmp = q| | ||||||||||||||||||||||||||||||||||||||||||
| 187 | background: transparent; | ||||||||||||||||||||||||||||||||||||||||||
| 188 | font-family: |. $specs->{face} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 189 | font-weight: |. $specs->{menustyle} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | font-size: |. $specs->{menusize} .q|;|; | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | $styles .= q| | ||||||||||||||||||||||||||||||||||||||||||
| 193 | A.NU { | ||||||||||||||||||||||||||||||||||||||||||
| 194 | color: |. $specs->{menucolor} .q|;|. $tmp .q| | ||||||||||||||||||||||||||||||||||||||||||
| 195 | text-decoration: none; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | A.NU:hover { | ||||||||||||||||||||||||||||||||||||||||||
| 198 | color: |. $specs->{menuhot} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | A.CP { | ||||||||||||||||||||||||||||||||||||||||||
| 201 | color: |. $specs->{menucold} .q|;|. $tmp .q| | ||||||||||||||||||||||||||||||||||||||||||
| 202 | text-decoration: none; | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | FONT.NU { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | color: |. $specs->{menucolor} .q|;|. $tmp .q| | ||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | TD.NU { | ||||||||||||||||||||||||||||||||||||||||||
| 208 | color: |. $specs->{menucolor} .q|;|. $tmp .q| | ||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | TD.S { | ||||||||||||||||||||||||||||||||||||||||||
| 211 | color: |. $specs->{sepcolor} .q|;|. $tmp .q| | ||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | .PT { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | color: |. $specs->{fontcolor} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 215 | background: transparent; | ||||||||||||||||||||||||||||||||||||||||||
| 216 | font-family: |. $specs->{face} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 217 | font-weight: |. $specs->{fontstyle} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 218 | font-size: |. $specs->{fontsize} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | .HT { | ||||||||||||||||||||||||||||||||||||||||||
| 221 | color: |. $specs->{headcolor} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 222 | background: transparent; | ||||||||||||||||||||||||||||||||||||||||||
| 223 | font-family: |. $specs->{face} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 224 | font-weight: |. $specs->{headstyle} .q|; | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | font-size: |. $specs->{headsize} .q|; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | my $Ls = ''; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | my $Mus = ''; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | foreach (1..$cols) { | |||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | $Ls .= '#L'. $_; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | $Mus .= '#menu'. $_; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | unless ($_ == $cols) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $Ls .= ','; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $Mus .= ','; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | $styles .= $Ls .q| { | ||||||||||||||||||||||||||||||||||||||||||
| 241 | position: relative; | ||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |. $Mus .q| { | ||||||||||||||||||||||||||||||||||||||||||
| 244 | position: absolute; | ||||||||||||||||||||||||||||||||||||||||||
| 245 | z-index: 100; | ||||||||||||||||||||||||||||||||||||||||||
| 246 | visibility: hidden; | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | width: |. $specs->{menuwidth} .q|; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | </style> | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | # find the number of drop down menus | ||||||||||||||||||||||||||||||||||||||||||
| 254 | # | ||||||||||||||||||||||||||||||||||||||||||
| 255 | # input: pointer to pages hash | ||||||||||||||||||||||||||||||||||||||||||
| 256 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 257 | # | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | ▶ | sub get_cols { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cols: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | my($pp,$page) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 1 | ▶ | return 0 unless exists $pp->{$page}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | my $cols = 0; | |||||||||||||||||||||||||||||||||||||||||
| 262 | # check for sub-menu's on menu items | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | foreach (@{$pp->{$page}->{menu}}) { | |||||||||||||||||||||||||||||||||||||||||
| 264 | # count if there are sub menu's | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 4 | ▶ | ++$cols if exists $pp->{$_} && exists $pp->{$_}->{submenu} && @{$pp->{$_}->{submenu}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
exists $pp->{$_} and exists $pp->{$_}{"submenu"} and @{$pp->{$_}{"submenu"};}
exists $pp->{$_} and exists $pp->{$_}{"submenu"}
MC/DC66%2/3
exists $pp->{$_} and exists $pp->{$_}{"submenu"} and @{$pp->{$_}{"submenu"};}
exists $pp->{$_}
exists $pp->{$_}{"submenu"}
@{$pp->{$_}{"submenu"};}
Truth table75%3/4
A and B and C
A= exists $pp->{$_}B= exists $pp->{$_}{"submenu"}C= @{$pp->{$_}{"submenu"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | return $cols; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | # generate values for 'name', 'href', 'onClick', 'link text', and 'status text' | ||||||||||||||||||||||||||||||||||||||||||
| 271 | # | ||||||||||||||||||||||||||||||||||||||||||
| 272 | # input: pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | # item | ||||||||||||||||||||||||||||||||||||||||||
| 274 | # returns: name, href, click, link text, status text | ||||||||||||||||||||||||||||||||||||||||||
| 275 | # | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | sub menuitem { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
menuitem: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | my($pp,$item) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 278 | return ($item, '#', | ||||||||||||||||||||||||||||||||||||||||||
| 279 | qq|onClick="return(npg('$item'));"|, | ||||||||||||||||||||||||||||||||||||||||||
| 280 | $item, $item | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | ) if exists $pp->{$item}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $item =~ m{(.)(.+)}; # skim off the first character | |||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my $s = quotemeta $1; # the seperator character | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my($name,$text,$status) = split(m{$s},$2); | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | $text = $name unless $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | $status = $text unless $status; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | return ($name, '#', | ||||||||||||||||||||||||||||||||||||||||||
| 288 | qq|onClick="return(npg('$name'));"|, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | $text, $status | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | ) if exists $pp->{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | return ($name, $name,'',$text,$status); | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | # generate menu bar | ||||||||||||||||||||||||||||||||||||||||||
| 295 | # | ||||||||||||||||||||||||||||||||||||||||||
| 296 | # input: pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 297 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # page width | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # debug page name | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # return: html for menu, | ||||||||||||||||||||||||||||||||||||||||||
| 301 | # div html for dropdowns | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # | ||||||||||||||||||||||||||||||||||||||||||
| 303 | # call this to fill a table row | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # i.e. $pagehtml = '<tr><td>' | ||||||||||||||||||||||||||||||||||||||||||
| 305 | # ($html,$div) = menugen(\%pages,$pagename); | ||||||||||||||||||||||||||||||||||||||||||
| 306 | # $pagehtml .= $html . $bodytext . $div; | ||||||||||||||||||||||||||||||||||||||||||
| 307 | # etc... | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub menugen { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
menugen: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my($pp,$page,$pw,$debug) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my @selectbar; | |||||||||||||||||||||||||||||||||||||||||
| 312 | return (' ','') unless | ||||||||||||||||||||||||||||||||||||||||||
| 313 | exists $pp->{$page} && exists $pp->{$page}->{menu} && | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | (@selectbar = @{$pp->{$page}->{menu}}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $pp->{$page} and exists $pp->{$page}{"menu"} and @selectbar = @{$pp->{$page}{"menu"};}
exists $pp->{$page} and exists $pp->{$page}{"menu"}
MC/DC0%0/3
exists $pp->{$page} and exists $pp->{$page}{"menu"} and @selectbar = @{$pp->{$page}{"menu"};}
exists $pp->{$page}
exists $pp->{$page}{"menu"}
@selectbar = @{$pp->{$page}{"menu"};}
Truth table0%0/4
A and B and C
A= exists $pp->{$page}B= exists $pp->{$page}{"menu"}C= @selectbar = @{$pp->{$page}{"menu"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | my $linkCount = 1; | |||||||||||||||||||||||||||||||||||||||||
| 316 | my $menustripe = ( exists $pp->{$page}->{menustripe} ) | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | ? qq| <tr align=top><td width=100%>$pp->{$page}->{menustripe}</td></tr> | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | | : ''; | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $div = ''; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $html = q|<div id="mh" class="mhs"><table cellspacing=0 cellpadding=0 border=0 width="|. $pw .q|"> | |||||||||||||||||||||||||||||||||||||||||
| 321 | <tr|; | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | $html .= $#selectbar | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | ? ' align=center>' | ||||||||||||||||||||||||||||||||||||||||||
| 324 | : '>'; | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $html .= "<td> </td>\n"; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $bar = 0; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | foreach(@selectbar) { | |||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my($name,$href,$click,$text,$status) = menuitem($pp,$_); | |||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | if ($bar) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $html .= q#<td class="S"> | </td>#; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $bar = 1; | |||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | my $class = ($name eq $page) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | ? 'CP' : 'NU'; | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $html .= qq| <td NOWRAP><a class="$class" |; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if (exists $pp->{$name} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $pp->{$name} and exists $pp->{$name}{"submenu"} and @{$pp->{$name}{"submenu"};}
exists $pp->{$name} and exists $pp->{$name}{"submenu"}
MC/DC0%0/3
exists $pp->{$name} and exists $pp->{$name}{"submenu"} and @{$pp->{$name}{"submenu"};}
exists $pp->{$name}
exists $pp->{$name}{"submenu"}
@{$pp->{$name}{"submenu"};}
Truth table0%0/4
A and B and C
A= exists $pp->{$name}B= exists $pp->{$name}{"submenu"}C= @{$pp->{$name}{"submenu"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | exists $pp->{$name}->{submenu} && | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | @{$pp->{$name}->{submenu}}) { # build menu links | |||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $html .= qq|id="L${linkCount}" href="$href" title="$status" onMouseout="return(headOut());" onMouseover="return(headOver('$status',$linkCount));" $click>$text</a></td> | |||||||||||||||||||||||||||||||||||||||||
| 341 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | $div .= qq|<div id="menu${linkCount}" class="dropdown"> | |||||||||||||||||||||||||||||||||||||||||
| 343 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | foreach my $sublink (@{$pp->{$name}->{submenu}}) { | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ($name,$href,$click,$text,$status) = menuitem($pp,$sublink); | |||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | $click = qq|onClick="return(linkClick('$name'));"| if $click; # fix up click return | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | $class = ($name eq $page || $name eq $debug) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$name eq $page or $name eq $debug
MC/DC0%0/2
$name eq $page or $name eq $debug
$name eq $page
$name eq $debug
Truth table0%0/3
A or B
A= $name eq $pageB= $name eq $debug
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | ? 'CP' : 'NU'; | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $div .= qq|<a class="$class" href="$href" title="$status" onMouseout="return(linkOut());" onMouseover="return(linkOver('$status'));" $click>$text</a><br> | |||||||||||||||||||||||||||||||||||||||||
| 350 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $div .= q|</div> | |||||||||||||||||||||||||||||||||||||||||
| 353 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ++$linkCount; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $html .= qq|href="$href" title="$status" onMouseover="return(oneOver('$status'));" onMouseout="return(linkOut());" $click>$text</a></td> | |||||||||||||||||||||||||||||||||||||||||
| 357 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $html .= qq|<td width=100%> </td></tr></table> | |||||||||||||||||||||||||||||||||||||||||
| 361 | $menustripe</div> | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | return($html,$div); | |||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | # generate the trailer | ||||||||||||||||||||||||||||||||||||||||||
| 367 | # | ||||||||||||||||||||||||||||||||||||||||||
| 368 | # input: pointer to specs hash, | ||||||||||||||||||||||||||||||||||||||||||
| 369 | # pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 370 | # page name, | ||||||||||||||||||||||||||||||||||||||||||
| 371 | # | ||||||||||||||||||||||||||||||||||||||||||
| 372 | # call this to fill a table row in the same manner as 'menugen' | ||||||||||||||||||||||||||||||||||||||||||
| 373 | # i.e. $pagehtml = '<tr><td>' | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | sub trailgen { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trailgen: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my($specs,$pp,$page) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my @selectbar; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | return ' ' unless exists $pp->{$page}->{trailer}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | my $html; | |||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $cols = 1; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if ( exists $pp->{$page}->{trailer}->{links} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $pp->{$page}{"trailer"}{"links"} and $cols = @selectbar = @{$pp->{$page}{"trailer"}{"links"};}
MC/DC0%0/2
exists $pp->{$page}{"trailer"}{"links"} and $cols = @selectbar = @{$pp->{$page}{"trailer"}{"links"};}
exists $pp->{$page}{"trailer"}{"links"}
$cols = @selectbar = @{$pp->{$page}{"trailer"}{"links"};}
Truth table0%0/3
A and B
A= exists $pp->{$page}{"trailer"}{"links"}B= $cols = @selectbar = @{$pp->{$page}{"trailer"}{"links"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ($cols = @selectbar = @{$pp->{$page}->{trailer}->{links}})) { | |||||||||||||||||||||||||||||||||||||||||
| 383 | # $html = q|<div class="mhs"><table cellspacing=0 cellpadding=0 border=0 width="|. $specs->{pagewidth} .q|"> | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $html = q|<div class="mhs"><table cellspacing=0 cellpadding=0 border=0 width="100%"> | |||||||||||||||||||||||||||||||||||||||||
| 385 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $cols *= 2; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | $cols += 1 if exists $pp->{$page}->{trailer}->{text} && $pp->{$page}->{trailer}->{text}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $pp->{$page}{"trailer"}{"text"} and $pp->{$page}{"trailer"}{"text"}
MC/DC0%0/2
exists $pp->{$page}{"trailer"}{"text"} and $pp->{$page}{"trailer"}{"text"}
exists $pp->{$page}{"trailer"}{"text"}
$pp->{$page}{"trailer"}{"text"}
Truth table0%0/3
A and B
A= exists $pp->{$page}{"trailer"}{"text"}B= $pp->{$page}{"trailer"}{"text"}
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ( exists $pp->{$page}->{trailer}->{top} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $html .= qq|<tr align=bottom><td colspan=$cols>$pp->{$page}->{trailer}->{top}</td></tr> | |||||||||||||||||||||||||||||||||||||||||
| 390 | | | ||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $html .= q|<tr align=center><td> </td> | |||||||||||||||||||||||||||||||||||||||||
| 393 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $bar = 0; | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | foreach (@selectbar) { | |||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my($name,$href,$click,$text,$status) = menuitem($pp,$_); | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if ($bar) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $html .= q#<td class='S'> | </td>#; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $bar = 1; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | my $class = $name eq $page ? 'CP' : 'NU'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $html .= qq| <td NOWRAP><a class="$class" |; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $html .= qq|href="$href" title="$status" onMouseover="return(oneOver('$status'));" onMouseout="return(linkOut());" $click>$text</a></td> | |||||||||||||||||||||||||||||||||||||||||
| 405 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | my $ttop = ( exists $pp->{$page}->{trailer}->{top} ) | ||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | ? qq|<tr align=bottom><td colspan=$cols>$pp->{$page}->{trailer}->{top}</td></tr> | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | | : ''; | ||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if (exists $pp->{$page}->{trailer}->{text} && $pp->{$page}->{trailer}->{text}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $pp->{$page}{"trailer"}{"text"} and $pp->{$page}{"trailer"}{"text"}
MC/DC0%0/2
exists $pp->{$page}{"trailer"}{"text"} and $pp->{$page}{"trailer"}{"text"}
exists $pp->{$page}{"trailer"}{"text"}
$pp->{$page}{"trailer"}{"text"}
Truth table0%0/3
A and B
A= exists $pp->{$page}{"trailer"}{"text"}B= $pp->{$page}{"trailer"}{"text"}
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if ($html) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | $html .= q|<td class="NU" align=right width="100%">|; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $html = qq|<div class="mhs"><table cellspacing=0 cellpadding=0 border=0 width="100%"> | |||||||||||||||||||||||||||||||||||||||||
| 417 | $ttop | ||||||||||||||||||||||||||||||||||||||||||
| 418 | <tr><td class="NU">|; | ||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $html .= $pp->{$page}->{trailer}->{text} .q| </td>|; | |||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | if ( $html && exists $pp->{$page}->{trailer}->{bottom} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$html and exists $pp->{$page}{"trailer"}{"bottom"}
MC/DC0%0/2
$html and exists $pp->{$page}{"trailer"}{"bottom"}
$html
exists $pp->{$page}{"trailer"}{"bottom"}
Truth table0%0/3
A and B
A= $htmlB= exists $pp->{$page}{"trailer"}{"bottom"}
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $html .= qq|</tr> | |||||||||||||||||||||||||||||||||||||||||
| 424 | <tr align=top><td colspan=$cols>$pp->{$page}->{trailer}->{bottom}</td>|; | ||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | return ' ' unless $html; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return $html .q|</tr></table></div> | |||||||||||||||||||||||||||||||||||||||||
| 428 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | # parse link text | ||||||||||||||||||||||||||||||||||||||||||
| 432 | # | ||||||||||||||||||||||||||||||||||||||||||
| 433 | # input: seperator, | ||||||||||||||||||||||||||||||||||||||||||
| 434 | # link string | ||||||||||||||||||||||||||||||||||||||||||
| 435 | # returns: page, text, status | ||||||||||||||||||||||||||||||||||||||||||
| 436 | # | ||||||||||||||||||||||||||||||||||||||||||
| 437 | 34 | ▶ | sub parseLINK { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parseLINK: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 34 | my($sep,$link) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 439 | 34 | $sep = quotemeta($sep); | |||||||||||||||||||||||||||||||||||||||||
| 440 | 34 | my ($page,$text,$status) = split(m{$sep},$link); | |||||||||||||||||||||||||||||||||||||||||
| 441 | 34 | ▶ | $text = $page unless $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 34 | ▶ | $status = $text unless $status; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 34 | return ($page,$text,$status); | |||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | # replace LINK text | ||||||||||||||||||||||||||||||||||||||||||
| 447 | # | ||||||||||||||||||||||||||||||||||||||||||
| 448 | # input: pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 449 | # html text | ||||||||||||||||||||||||||||||||||||||||||
| 450 | # returns: updated html | ||||||||||||||||||||||||||||||||||||||||||
| 451 | # | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 2 | ▶ | sub fixLINKs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fixLINKs: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | my($pp,$html) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 454 | 2 | ▶ | while ($html =~ m{LINK([C-Z]?)\<(.)([^>]+)>}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 34 | ▶ | my $class = $1 || "B"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$1 || 'B'
MC/DC0%0/1
$1 || 'B'
$1
Truth table50%1/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | 34 | my $match = quotemeta $&; | |||||||||||||||||||||||||||||||||||||||||
| 457 | 34 | my($page,$link,$status) = parseLINK($2,$3); | |||||||||||||||||||||||||||||||||||||||||
| 458 | 34 | my $replacement = q|<a class="|. $class .q|" title="|. $status .q|" onMouseOver="self.status='|. $status . q|';return true;" onMouseOut="self.status='';return true;" |; | |||||||||||||||||||||||||||||||||||||||||
| 459 | 34 | ▶ | if (exists $pp->{$page}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | 16 | $replacement .= q|onClick="return(npg('|. $page .q|'));" href="./">|; | |||||||||||||||||||||||||||||||||||||||||
| 461 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 462 | 18 | $replacement .= q|href="|. $page .q|">|; | |||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 34 | $replacement .= $link .q|</a>|; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 34 | $html =~ s/$match/$replacement/; | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 2 | return $html; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | # generate text from file | ||||||||||||||||||||||||||||||||||||||||||
| 471 | # | ||||||||||||||||||||||||||||||||||||||||||
| 472 | # input: pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 473 | # file name | ||||||||||||||||||||||||||||||||||||||||||
| 474 | # returns: html text | ||||||||||||||||||||||||||||||||||||||||||
| 475 | # | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 5 | ▶ | sub file2text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file2text: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 5 | my($pp,$file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 5 | my $html; | |||||||||||||||||||||||||||||||||||||||||
| 479 | 5 | local *F; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 5 | ▶ | if (-e $file && open F, $file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-e $file and open F, $file
MC/DC50%1/2
-e $file and open F, $file
-e $file
open F, $file
Truth table66%2/3
A and B
A= -e $fileB= open F, $file
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | local $/ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | $html = fixLINKs($pp,<F>); | |||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | close F; | |||||||||||||||||||||||||||||||||||||||||
| 484 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | 4 | $html = ' '; | |||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 5 | return $html; | |||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | # similar to above | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | sub fileLoad { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fileLoad: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my($file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | my $html; | |||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | local *F; | |||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if (-e $file && open F, $file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e $file and open F, $file
MC/DC0%0/2
-e $file and open F, $file
-e $file
open F, $file
Truth table0%0/3
A and B
A= -e $fileB= open F, $file
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | local $/ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $html = <F>; | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | close F; | |||||||||||||||||||||||||||||||||||||||||
| 500 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $html = ''; | |||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | return $html; | |||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | # return column array | ||||||||||||||||||||||||||||||||||||||||||
| 507 | # | ||||||||||||||||||||||||||||||||||||||||||
| 508 | # input: pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 509 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 510 | # page width | ||||||||||||||||||||||||||||||||||||||||||
| 511 | # returns: column array | ||||||||||||||||||||||||||||||||||||||||||
| 512 | # | ||||||||||||||||||||||||||||||||||||||||||
| 513 | 2 | ▶ | sub getColArray { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getColArray: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 2 | my($pp,$page,$pw) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 515 | return (exists $pp->{$page}->{column} && # column array | ||||||||||||||||||||||||||||||||||||||||||
| 516 | ref $pp->{$page}->{column} eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||
| 517 | 2 | ▶ | ? @{$pp->{$page}->{column}} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $pp->{$page}{"column"} and ref $pp->{$page}{"column"} eq "ARRAY"
MC/DC50%1/2
exists $pp->{$page}{"column"} and ref $pp->{$page}{"column"} eq "ARRAY"
exists $pp->{$page}{"column"}
ref $pp->{$page}{"column"} eq "ARRAY"
Truth table66%2/3
A and B
A= exists $pp->{$page}{"column"}B= ref $pp->{$page}{"column"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | : ($pw); | ||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | # generate main body text | ||||||||||||||||||||||||||||||||||||||||||
| 522 | # | ||||||||||||||||||||||||||||||||||||||||||
| 523 | # input: pointer to specs hash, | ||||||||||||||||||||||||||||||||||||||||||
| 524 | # pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 525 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 526 | # page width | ||||||||||||||||||||||||||||||||||||||||||
| 527 | # pages directory path | ||||||||||||||||||||||||||||||||||||||||||
| 528 | # returns: html | ||||||||||||||||||||||||||||||||||||||||||
| 529 | # | ||||||||||||||||||||||||||||||||||||||||||
| 530 | # call this to fill a table row in the same manner as 'menugen' | ||||||||||||||||||||||||||||||||||||||||||
| 531 | # i.e. $pagehtml = '<tr><td>' | ||||||||||||||||||||||||||||||||||||||||||
| 532 | # | ||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 2 | ▶ | sub bodygen { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bodygen: called CC=11 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | my($specs,$pp,$page,$pw,$pd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 536 | 2 | ▶ | return '' unless exists $pp->{$page}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | 2 | my @ca = getColArray($pp,$page,$pw); | |||||||||||||||||||||||||||||||||||||||||
| 538 | 2 | my($smp,$smn); # sitemap path and position number | |||||||||||||||||||||||||||||||||||||||||
| 539 | 2 | ▶ | if ($page eq 'Sitemap' && exists $specs->{sitemapdir}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$page eq "Sitemap" and exists $specs->{"sitemapdir"}
MC/DC0%0/2
$page eq "Sitemap" and exists $specs->{"sitemapdir"}
$page eq "Sitemap"
exists $specs->{"sitemapdir"}
Truth table33%1/3
A and B
A= $page eq "Sitemap"B= exists $specs->{"sitemapdir"}
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | $smp = $specs->{sitemapdir} . 'sitemap.htxt'; | |||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | $smn = $pp->{Sitemap}->{autocol} || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$pp->{'Sitemap'}{'autocol'} || 1
MC/DC0%0/1
$pp->{'Sitemap'}{'autocol'} || 1
$pp->{'Sitemap'}{'autocol'}
Truth table0%0/2
A
A= $pp->{'Sitemap'}{'autocol'}
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 2 | ▶ | my $phead = $pp->{$page}->{heading} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$pp->{$page}{'heading'} || ''
MC/DC0%0/1
$pp->{$page}{'heading'} || ''
$pp->{$page}{'heading'}
Truth table50%1/2
A
A= $pp->{$page}{'heading'}
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 2 | my $html = q|<table cellspacing=5 cellpadding=0 border=0 width="|. $pw .q|">|."\n <tr>"; | |||||||||||||||||||||||||||||||||||||||||
| 545 | 2 | foreach (@ca) { | |||||||||||||||||||||||||||||||||||||||||
| 546 | 4 | $html .= q|<td width=|. $_ .q|> </td>|; | |||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 548 | 2 | $html .= "</tr>\n"; | |||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 2 | $_ = @ca; # number of columns | |||||||||||||||||||||||||||||||||||||||||
| 551 | 2 | ▶ | if ($phead) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $html .= q| <tr><td colspan=|. $_ .q|><font class=HT>|. $phead .q|</font></td></tr> | |||||||||||||||||||||||||||||||||||||||||
| 553 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 2 | $html .= q| <tr><td colspan=|. $_ .q|> </td></tr> | |||||||||||||||||||||||||||||||||||||||||
| 556 | <tr>|; | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 2 | foreach (1..@ca) { | |||||||||||||||||||||||||||||||||||||||||
| 559 | 4 | $html .= q|<td valign=top class=PT>|; | |||||||||||||||||||||||||||||||||||||||||
| 560 | 4 | ▶ | if ($smn && $smn == $_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$smn and $smn == $_
MC/DC0%0/2
$smn and $smn == $_
$smn
$smn == $_
Truth table33%1/3
A and B
A= $smnB= $smn == $_
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $html .= file2text($pp,$smp); | |||||||||||||||||||||||||||||||||||||||||
| 562 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 563 | 4 | my $file = $pd . $page .'.c'. $_; | |||||||||||||||||||||||||||||||||||||||||
| 564 | 4 | $html .= file2text($pp,$file); | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | 4 | $html .= '</td>'; | |||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||
| 568 | 2 | return $html .q|</tr></table>|; | |||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | # display the source for a page | ||||||||||||||||||||||||||||||||||||||||||
| 572 | # | ||||||||||||||||||||||||||||||||||||||||||
| 573 | # input: pointer to page hash, | ||||||||||||||||||||||||||||||||||||||||||
| 574 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 575 | # page width | ||||||||||||||||||||||||||||||||||||||||||
| 576 | # pages directory path | ||||||||||||||||||||||||||||||||||||||||||
| 577 | # returns html | ||||||||||||||||||||||||||||||||||||||||||
| 578 | # | ||||||||||||||||||||||||||||||||||||||||||
| 579 | # call this to fill a table row in the same manner as 'menugen' | ||||||||||||||||||||||||||||||||||||||||||
| 580 | # i.e. $pagehtml = '<tr><td>' | ||||||||||||||||||||||||||||||||||||||||||
| 581 | # | ||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | sub srcgen { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
srcgen: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | my($pp,$page,$pw,$pd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | return '' unless exists $pp->{$page}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my $html = q|<table cellspacing=0 cellpadding=0 border=0 width="|. $pw .q|"> | |||||||||||||||||||||||||||||||||||||||||
| 586 | <tr><td ><font class=HT>|. $page .q|</font></td></tr> | ||||||||||||||||||||||||||||||||||||||||||
| 587 | <tr><td valign=top class=PT><hr> | ||||||||||||||||||||||||||||||||||||||||||
| 588 | <pre>|; | ||||||||||||||||||||||||||||||||||||||||||
| 589 | my $tmp = (exists $pp->{$page}->{location}) | ||||||||||||||||||||||||||||||||||||||||||
| 590 | ? $pp->{$page}->{location} | ||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | ▶ | : $pd . $page; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $tmp = fileLoad($tmp); | |||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | $tmp =~ s|<|<|g; | |||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $tmp =~ s|>|>|g; | |||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | chop $tmp if $tmp =~ /\n$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | return $html . $tmp .q| | |||||||||||||||||||||||||||||||||||||||||
| 597 | </pre> | ||||||||||||||||||||||||||||||||||||||||||
| 598 | <hr> | ||||||||||||||||||||||||||||||||||||||||||
| 599 | </td></tr></table>|; | ||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | # convert query string to hash | ||||||||||||||||||||||||||||||||||||||||||
| 603 | # | ||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | sub _cto { die "child query read timeout" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cto: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 9 | ▶ | sub query2hash () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query2hash: called CC=10 SCAR=23.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | 9 | ▶ | return () unless defined $ENV{REQUEST_METHOD}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 608 | 9 | my $tmp = uc $ENV{REQUEST_METHOD}; | |||||||||||||||||||||||||||||||||||||||||
| 609 | 9 | my $buff = ''; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 9 | ▶ | if ('GET' eq $tmp && defined $ENV{QUERY_STRING}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
"GET" eq $tmp and defined $ENV{"QUERY_STRING"}
MC/DC50%1/2
"GET" eq $tmp and defined $ENV{"QUERY_STRING"}
"GET" eq $tmp
defined $ENV{"QUERY_STRING"}
Truth table66%2/3
A and B
A= "GET" eq $tmpB= defined $ENV{"QUERY_STRING"}
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 4 | $buff = $ENV{QUERY_STRING}; | |||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||
| 613 | ▶ | elsif ('POST' eq $tmp && defined $ENV{CONTENT_LENGTH} && $ENV{CONTENT_LENGTH}) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
"POST" eq $tmp and defined $ENV{"CONTENT_LENGTH"} and $ENV{"CONTENT_LENGTH"}
"POST" eq $tmp and defined $ENV{"CONTENT_LENGTH"}
MC/DC66%2/3
"POST" eq $tmp and defined $ENV{"CONTENT_LENGTH"} and $ENV{"CONTENT_LENGTH"}
"POST" eq $tmp
defined $ENV{"CONTENT_LENGTH"}
$ENV{"CONTENT_LENGTH"}
Truth table75%3/4
A and B and C
A= "POST" eq $tmpB= defined $ENV{"CONTENT_LENGTH"}C= $ENV{"CONTENT_LENGTH"}
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 1 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 615 | 1 | local $SIG{ALRM} = \&_cto; | |||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | alarm 5; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | $tmp = read(STDIN,$buff,$ENV{CONTENT_LENGTH}); | |||||||||||||||||||||||||||||||||||||||||
| 618 | 1 | alarm 0; | |||||||||||||||||||||||||||||||||||||||||
| 619 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | ▶ | return () if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||
| 622 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 4 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | 5 | my %qhash = (); | |||||||||||||||||||||||||||||||||||||||||
| 626 | 5 | my @content = split(/&/,$buff); | |||||||||||||||||||||||||||||||||||||||||
| 627 | 5 | foreach (@content) { | |||||||||||||||||||||||||||||||||||||||||
| 628 | 12 | $_ =~ s/\+/ /g; # convert +'s to spaces | |||||||||||||||||||||||||||||||||||||||||
| 629 | 12 | my($key,$val) = split(/=/,$_,2); | |||||||||||||||||||||||||||||||||||||||||
| 630 | # convert hex characters back to ascii | ||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | $key =~ s/%(..)/pack("c",hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||
| 632 | 12 | $val =~ s/%(..)/pack("c",hex($1))/ge; | |||||||||||||||||||||||||||||||||||||||||
| 633 | 12 | ▶ | if (exists $qhash{$key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $qhash{$key} .= "\0" . $val; | |||||||||||||||||||||||||||||||||||||||||
| 635 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 636 | 12 | $qhash{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||
| 639 | 5 | return %qhash; | |||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | # build a web page | ||||||||||||||||||||||||||||||||||||||||||
| 643 | # | ||||||||||||||||||||||||||||||||||||||||||
| 644 | # input: pointer to specs, | ||||||||||||||||||||||||||||||||||||||||||
| 645 | # pointer to pages | ||||||||||||||||||||||||||||||||||||||||||
| 646 | # prints: to STDOUT | ||||||||||||||||||||||||||||||||||||||||||
| 647 | # | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | sub build { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | my($specs,$pp) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | my %query = &query2hash; | |||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | my $page = $query{page} || 'Home'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$query{'page'} || 'Home'
MC/DC0%0/1
$query{'page'} || 'Home'
$query{'page'}
Truth table0%0/2
A
A= $query{'page'}
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | ▶ | $page = 'Home' unless exists $pp->{$page}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | my $tmp = $pp->{$page}->{debug} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$pp->{$page}{'debug'} || ''
MC/DC0%0/1
$pp->{$page}{'debug'} || ''
$pp->{$page}{'debug'}
Truth table0%0/2
A
A= $pp->{$page}{'debug'}
| |||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | my $debug = ''; | |||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | ▶ | if ($tmp) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | $debug = $page; | |||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | $page = $tmp; | |||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | my $mtime = checkspecs($specs); # set defaults for missing specs | |||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | # update the site map if needed | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | updsitemap($specs,$pp,$mtime); | |||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | # build the head | ||||||||||||||||||||||||||||||||||||||||||
| 665 | # | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | my $pagedir = $specs->{pagedir}; | |||||||||||||||||||||||||||||||||||||||||
| 667 | my $title = (exists $pp->{$page}->{title}) | ||||||||||||||||||||||||||||||||||||||||||
| 668 | ? $pp->{$page}->{title} | ||||||||||||||||||||||||||||||||||||||||||
| 669 | : (exists $pp->{$page}->{heading}) | ||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | ? $pp->{$page}->{heading} : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | my $html = q|<!-- page built by Web::Scaffold version |. $Web::Scaffold::VERSION .q| --> | |||||||||||||||||||||||||||||||||||||||||
| 673 | <head><title>| . $title .q|</title> | ||||||||||||||||||||||||||||||||||||||||||
| 674 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | $tmp = fileLoad($pagedir . $page .'.meta'); | |||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | $tmp = fileLoad($pagedir .'Default.meta') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | unless $tmp; | ||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | $html .= $tmp; | |||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | $tmp = get_cols($pp,$page); | |||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | $html .= stylegen($specs,$tmp); | |||||||||||||||||||||||||||||||||||||||||
| 681 | $html .= q|<script language="javascript1.2" src="|. $specs->{javascript} .q|winUtils.js"> | ||||||||||||||||||||||||||||||||||||||||||
| 682 | </script> | ||||||||||||||||||||||||||||||||||||||||||
| 683 | <script language="javascript1.2" src="|. $specs->{javascript} .q|winMenus.js"> | ||||||||||||||||||||||||||||||||||||||||||
| 684 | </script> | ||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | <script language="javascript1.2" src="|. $specs->{javascript} .q|scaffold.js"> | |||||||||||||||||||||||||||||||||||||||||
| 686 | </script> | ||||||||||||||||||||||||||||||||||||||||||
| 687 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | $tmp = fileLoad($pagedir . $page . '.head'); | |||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | $tmp = fileLoad($pagedir .'Default.head') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 690 | unless $tmp; | ||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | $html .= $tmp; | |||||||||||||||||||||||||||||||||||||||||
| 692 | $html .= q| | ||||||||||||||||||||||||||||||||||||||||||
| 693 | </head> | ||||||||||||||||||||||||||||||||||||||||||
| 694 | <body bgcolor="|. $specs->{backcolor} .q|"> | ||||||||||||||||||||||||||||||||||||||||||
| 695 | <noscript> | ||||||||||||||||||||||||||||||||||||||||||
| 696 | <font size=4 color=red>You must enable Javascript1.2 or better<br>to view | ||||||||||||||||||||||||||||||||||||||||||
| 697 | all the features on this page</font> | ||||||||||||||||||||||||||||||||||||||||||
| 698 | </noscript> | ||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | <form id="silent" name="silent" action=index.shtml method=get> | ||||||||||||||||||||||||||||||||||||||||||
| 701 | <input type=hidden name=page value=""> | ||||||||||||||||||||||||||||||||||||||||||
| 702 | </form> | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | <table cellspacing=0 cellpadding=0 border=0 width="|. $specs->{pagewidth} .q|"> | |||||||||||||||||||||||||||||||||||||||||
| 704 | <tr><td>|; | ||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | $tmp = fileLoad($pagedir . $page .'.top'); | |||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | ▶ | $tmp = fileLoad($pagedir .'Default.top') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | unless $tmp; | ||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | $html .= $tmp; | |||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $html .= q|</td></tr> | |||||||||||||||||||||||||||||||||||||||||
| 711 | <tr><td>|; | ||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | my $divtxt = ''; | |||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | ▶ | if ( exists $pp->{$page}->{menu} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $pp->{$page}{"menu"} and ref $pp->{$page}{"menu"} eq "ARRAY" and @{$pp->{$page}{"menu"};}
exists $pp->{$page}{"menu"} and ref $pp->{$page}{"menu"} eq "ARRAY"
MC/DC0%0/3
exists $pp->{$page}{"menu"} and ref $pp->{$page}{"menu"} eq "ARRAY" and @{$pp->{$page}{"menu"};}
exists $pp->{$page}{"menu"}
ref $pp->{$page}{"menu"} eq "ARRAY"
@{$pp->{$page}{"menu"};}
Truth table0%0/4
A and B and C
A= exists $pp->{$page}{"menu"}B= ref $pp->{$page}{"menu"} eq "ARRAY"C= @{$pp->{$page}{"menu"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 715 | ref $pp->{$page}->{menu} eq 'ARRAY' && | ||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | @{$pp->{$page}->{menu}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | (my $mnutxt,$divtxt) = menugen($pp,$page,$specs->{pagewidth},$debug); | |||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | $html .= $mnutxt . q|</td></tr> | |||||||||||||||||||||||||||||||||||||||||
| 719 | <tr><td>|; | ||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | if ($debug) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $html .= srcgen($pp,$debug,$specs->{pagewidth},$pagedir); | |||||||||||||||||||||||||||||||||||||||||
| 723 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | $html .= bodygen($specs,$pp,$page,$specs->{pagewidth},$pagedir); | |||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | $html .= "\n". $divtxt .q|<font size=1> <p></font> | |||||||||||||||||||||||||||||||||||||||||
| 727 | </td></tr> | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | if ( exists $pp->{$page}->{trailer} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $pp->{$page}{"trailer"} and ref $pp->{$page}{"trailer"} eq "HASH"
MC/DC0%0/2
exists $pp->{$page}{"trailer"} and ref $pp->{$page}{"trailer"} eq "HASH"
exists $pp->{$page}{"trailer"}
ref $pp->{$page}{"trailer"} eq "HASH"
Truth table0%0/3
A and B
A= exists $pp->{$page}{"trailer"}B= ref $pp->{$page}{"trailer"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | ref $pp->{$page}->{trailer} eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $html .= q|<tr align=bottom><td>|. trailgen($specs,$pp,$page) . q|</td></tr> | |||||||||||||||||||||||||||||||||||||||||
| 732 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | $html .= q|</table> | |||||||||||||||||||||||||||||||||||||||||
| 735 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | print $html; | |||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | ################################### | ||||||||||||||||||||||||||||||||||||||||||
| 740 | # sitemap code | ||||||||||||||||||||||||||||||||||||||||||
| 741 | ################################### | ||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | # check for LINKs and HREFs in a scaffold page | ||||||||||||||||||||||||||||||||||||||||||
| 744 | # | ||||||||||||||||||||||||||||||||||||||||||
| 745 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 746 | # sitemap ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 747 | # pages ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 748 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 749 | # returns: last modified time for page | ||||||||||||||||||||||||||||||||||||||||||
| 750 | # | ||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | sub chk4links { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chk4links: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | my($specs,$sm,$pages,$pg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 753 | #print "CHK4LINKS $pg\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 754 | # load page text | ||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | local *H; | |||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | my $html = ''; | |||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | ▶ | opendir(H,$specs->{pagedir}) or die "could not open $specs->{pagedir}\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | my @files = grep($_ =~ /${pg}\.[^~]+$/,readdir(H)); | |||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | my $mtime = 0; | |||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | foreach my $f (qw(meta head top)) { # include defaults | |||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | unless (grep(/$f$/,@files)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | push @files, 'Default.'. $f; | |||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 766 | { | ||||||||||||||||||||||||||||||||||||||||||
| 767 | #print "FILES = @files\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | undef local $/; | |||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | foreach (@files) { | |||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | my $file = $specs->{pagedir} . $_; | |||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | ▶ | next unless -e $file; # skip non-existent defaults | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | my $m = (stat($file))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | $mtime = $m if $mtime < $m; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | ▶ | next if $_ =~ /(?:meta|head)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | next unless open(H,$file); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | $html .= <H>; | |||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | close H; | |||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||
| 780 | # check for LINKS | ||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | my @links; | |||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | ▶ | while ($html =~ m{LINK\<(.)([^>]+)>}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | $html = $` . $'; # reconstitute HTML with string removed | |||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | my $sep = $1; | |||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | my($plink,$text,$status) = parseLINK($1,$2); | |||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | ▶ | next if exists $sm->{$plink}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | if (exists $pages->{$plink}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | $sm->{$plink} = [$sep,$plink,$status]; | |||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | push @links, [$plink,1]; | |||||||||||||||||||||||||||||||||||||||||
| 790 | ▶ | } elsif ($plink !~ m|\://| && $plink !~ /\@/) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$plink =~ m[\://] || $plink =~ /\@/
MC/DC0%0/2
$plink =~ m[\://] || $plink =~ /\@/
$plink =~ m[\://]
$plink =~ /\@/
Truth table0%0/3
A || B
A= $plink =~ m[\://]B= $plink =~ /\@/
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | $sm->{$plink} = [$sep,$plink,$status]; | |||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | push @links, [$plink,0]; | |||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||
| 795 | # all links collected and marked, recurse links | ||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | foreach (@links) { | |||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | my($plink,$isLINK) = @{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $tab = $specs->{'_tab'}; | |||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | push @{$specs->{'_sm'}}, [$tab,$plink]; | |||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | if ($isLINK) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | rcursite($specs,$sm,$pages,$plink); # recurse if a menu page | |||||||||||||||||||||||||||||||||||||||||
| 802 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | chkLocalPage($specs,$sm,$plink); | |||||||||||||||||||||||||||||||||||||||||
| 804 | } | ||||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||
| 806 | # check for HREF's | ||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | return $mtime if nosearch($specs,$pg); # don't check links if no search | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | chk4hrefs($specs,$sm,\$html); | |||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | $mtime; | |||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | # check for HREFs in an string | ||||||||||||||||||||||||||||||||||||||||||
| 813 | # | ||||||||||||||||||||||||||||||||||||||||||
| 814 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 815 | # sitemap ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 816 | # string ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 817 | # | ||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | sub chk4hrefs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chk4hrefs: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | my($specs,$sm,$hp) =@_; | |||||||||||||||||||||||||||||||||||||||||
| 820 | # while ($$hp =~ m{href=\"?([^?" \r\n]+)}) { | ||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | my @links; | |||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | while ($$hp =~ m{<a\s+href=\"?([^?" >\r\n]+)(.*?<)/a>}si) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | my $match = $&; | |||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | my $link = $1; | |||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | $$hp = $` . $'; # reconstitute HTML with string removed | |||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $2 =~ />(.*?)</s; | |||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | my $text = $1; | |||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | ▶ | next unless $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | unless (exists $sm->{$link} || $link =~ m|\://|s || $link =~ /\@/s) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $sm->{$link} or $link =~ m[\://]s or $link =~ /\@/s
exists $sm->{$link} or $link =~ m[\://]s
MC/DC0%0/3
exists $sm->{$link} or $link =~ m[\://]s or $link =~ /\@/s
exists $sm->{$link}
$link =~ m[\://]s
$link =~ /\@/s
Truth table0%0/4
A or B or C
A= exists $sm->{$link}B= $link =~ m[\://]sC= $link =~ /\@/s
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | my $sep; # scoping error in perl foreach 5.6.1 | |||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | foreach ('#', '!', '%', '&',('0'..'9'),('A'..'Z'),('a'..'z')) { | |||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | ▶ | next if $match =~ /$_/s; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $sep = $_; | |||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | 0 | $sm->{$link} = [$sep,$link,$text]; | |||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | push @links, $link; | |||||||||||||||||||||||||||||||||||||||||
| 838 | } | ||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||
| 840 | # all links collected and marked, recurse them | ||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | my $tab = $specs->{'_tab'}; | |||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | foreach my $link (@links) { | |||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | push @{$specs->{'_sm'}}, [$tab,$link]; | |||||||||||||||||||||||||||||||||||||||||
| 844 | #print "ck4............. $link to LCL\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | chkLocalPage($specs,$sm,$link); | |||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | # check for no search | ||||||||||||||||||||||||||||||||||||||||||
| 850 | # | ||||||||||||||||||||||||||||||||||||||||||
| 851 | # input: pointer to specs | ||||||||||||||||||||||||||||||||||||||||||
| 852 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 853 | # returns: true = no search | ||||||||||||||||||||||||||||||||||||||||||
| 854 | # else false | ||||||||||||||||||||||||||||||||||||||||||
| 855 | # | ||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | sub nosearch { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nosearch: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | my($specs,$pg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | ▶ | if (exists $specs->{nosearch}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | foreach(@{$specs->{nosearch}}) { | |||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | return 1 if $pg =~ /$_/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | # check an HTML page for HREF's | ||||||||||||||||||||||||||||||||||||||||||
| 867 | # | ||||||||||||||||||||||||||||||||||||||||||
| 868 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 869 | # sitemap ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 870 | # string ptr | ||||||||||||||||||||||||||||||||||||||||||
| 871 | # | ||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | ▶ | sub chkLocalPage { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chkLocalPage: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | my($specs,$sm,$pg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | $pg =~ s|/|| | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | if $pg =~ m|^/|; | ||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ▶ | return unless -e $pg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | ${$sm->{$pg}}[3] = (stat($pg))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | ▶ | return if nosearch($specs,$pg); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 879 | # ++$specs->{'_tab'}; | ||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | local *F; | |||||||||||||||||||||||||||||||||||||||||
| 881 | #print "LOCLPG $pg\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | return unless open(F,$pg); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | undef local $/; | |||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my $html = <F>; | |||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | close F; | |||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | chk4hrefs($specs,$sm,\$html); | |||||||||||||||||||||||||||||||||||||||||
| 887 | # --$specs->{'_tab'}; | ||||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | # recurse through scaffold pages beginning with 'page' to build sitemap | ||||||||||||||||||||||||||||||||||||||||||
| 891 | # | ||||||||||||||||||||||||||||||||||||||||||
| 892 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 893 | # sitemap ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 894 | # pages ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 895 | # page name | ||||||||||||||||||||||||||||||||||||||||||
| 896 | # | ||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | sub rcursite { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rcursite: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | my($specs,$sm,$pages,$pg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | return unless exists $pages->{$pg} && exists $pages->{$pg}->{menu}; # skip debug pages | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $pages->{$pg} and exists $pages->{$pg}{"menu"}
MC/DC0%0/2
exists $pages->{$pg} and exists $pages->{$pg}{"menu"}
exists $pages->{$pg}
exists $pages->{$pg}{"menu"}
Truth table0%0/3
A and B
A= exists $pages->{$pg}B= exists $pages->{$pg}{"menu"}
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my $tab = ++$specs->{'_tab'}; | |||||||||||||||||||||||||||||||||||||||||
| 901 | #print "RPAGE = ........ $pg\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 903 | # check menu's | ||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | my @pages = @{$pages->{$pg}->{menu}}; | |||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | if (exists $pages->{$pg}->{submenu}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | push @pages, @{$pages->{$pg}->{submenu}}; | |||||||||||||||||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | if (exists $pages->{$pg}->{trailer} && exists $pages->{$pg}->{trailer}->{links}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $pages->{$pg}{"trailer"} and exists $pages->{$pg}{"trailer"}{"links"}
MC/DC0%0/2
exists $pages->{$pg}{"trailer"} and exists $pages->{$pg}{"trailer"}{"links"}
exists $pages->{$pg}{"trailer"}
exists $pages->{$pg}{"trailer"}{"links"}
Truth table0%0/3
A and B
A= exists $pages->{$pg}{"trailer"}B= exists $pages->{$pg}{"trailer"}{"links"}
| |||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | push @pages, @{$pages->{$pg}->{trailer}->{links}}; | |||||||||||||||||||||||||||||||||||||||||
| 910 | } | ||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my @lclks; # local links this page | |||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | foreach (0..$#pages) { | |||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | my $pgname = $pages[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | next if exists $sm->{$pgname}; # pick off most of the page names early | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 915 | #print "PROCESS $pgname\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | my $text = my $status = $pgname; | |||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | my $sep = '#'; | |||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | unless (exists $pages->{$pgname}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | $pgname =~ m{(.)(.+)}; # skim off the first character | |||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | $sep = $1; | |||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | ($pgname,$text,$status) = parseLINK($1,$2); | |||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | $text = $pgname unless $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | ▶ | $status = $text unless $status; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | $pages[$_] = $pgname; | |||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | next if exists $sm->{$pgname}; # pick off all processed page names | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ▶ | if (exists $pages->{$pgname}) { # if this is a scaffold page | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | $sm->{$pgname} = [$sep,$pgname,$status]; | |||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | push @lclks, [$pgname,1]; | |||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||
| 931 | ▶ | elsif ($pgname !~ m|\://| && $pgname !~ /\@/) { # or a link but not absolute or mail | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$pgname =~ m[\://] || $pgname =~ /\@/
MC/DC0%0/2
$pgname =~ m[\://] || $pgname =~ /\@/
$pgname =~ m[\://]
$pgname =~ /\@/
Truth table0%0/3
A || B
A= $pgname =~ m[\://]B= $pgname =~ /\@/
| |||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | $sm->{$pgname} = [$sep,$pgname,$status]; | |||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | push @lclks, [$pgname,0]; | |||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||
| 936 | # chk4links($specs,$sm,$pages,$pg) | ||||||||||||||||||||||||||||||||||||||||||
| 937 | # unless exists $sm->{$pg}; | ||||||||||||||||||||||||||||||||||||||||||
| 938 | # page level is established, recurse each link | ||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | foreach (@lclks) { | |||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | my($pgname,$isLINK) = @{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | push @{$specs->{'_sm'}}, [$tab,$pgname]; | |||||||||||||||||||||||||||||||||||||||||
| 942 | #print "RECURSING $pgname\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | ▶ | if ($isLINK) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | rcursite($specs,$sm,$pages,$pgname); | |||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||
| 946 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 947 | #print "rcur........... $pgname to LCL\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | chkLocalPage($specs,$sm,$pgname); | |||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | ${$sm->{$pg}}[3] = chk4links($specs,$sm,$pages,$pg); | |||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | --$specs->{'_tab'}; | |||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||
| 955 | # build a sitemap structure | ||||||||||||||||||||||||||||||||||||||||||
| 956 | # | ||||||||||||||||||||||||||||||||||||||||||
| 957 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 958 | # pages ptr | ||||||||||||||||||||||||||||||||||||||||||
| 959 | # | ||||||||||||||||||||||||||||||||||||||||||
| 960 | # returns: sitemap hash pointer | ||||||||||||||||||||||||||||||||||||||||||
| 961 | # | ||||||||||||||||||||||||||||||||||||||||||
| 962 | # REMEMBER to DELETE $specs->{_tab} {_sm} when done | ||||||||||||||||||||||||||||||||||||||||||
| 963 | # | ||||||||||||||||||||||||||||||||||||||||||
| 964 | 0 | ▶ | sub sitestruct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sitestruct: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | my($specs,$pages) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | $specs->{'_tab'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | $specs->{_sm} = []; | |||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | my $sitemap = { | |||||||||||||||||||||||||||||||||||||||||
| 969 | Home => ['#','Home','Home'], | ||||||||||||||||||||||||||||||||||||||||||
| 970 | Default => ['#','Default','Default'], | ||||||||||||||||||||||||||||||||||||||||||
| 971 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | push @{$specs->{_sm}}, [0,'Home']; | |||||||||||||||||||||||||||||||||||||||||
| 973 | # chk4links($specs,$sitemap,$pages,'Home'); | ||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | chk4links($specs,$sitemap,$pages,'Default'); # include Default contents | |||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | delete $sitemap->{Default}; # page name does not belong in sitemap | |||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | rcursite($specs,$sitemap,$pages,'Home'); | |||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | chkLocalPage($specs,$sitemap,'index.shtml'); | |||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | return $sitemap; | |||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||
| 981 | # return xml time for sitemap xml files | ||||||||||||||||||||||||||||||||||||||||||
| 982 | # | ||||||||||||||||||||||||||||||||||||||||||
| 983 | # input: time since the epoch | ||||||||||||||||||||||||||||||||||||||||||
| 984 | # returns: yyyy-mm-dd | ||||||||||||||||||||||||||||||||||||||||||
| 985 | # | ||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | sub xmltime { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xmltime: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | my $time = shift; | |||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | my($mday,$mon,$year) = (localtime($time))[3,4,5]; | |||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ++$mon; | |||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | $year += 1900; | |||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | return sprintf("%04d-%02d-%02d",$year,$mon,$mday); | |||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||
| 994 | # build html and xml sitemap pages | ||||||||||||||||||||||||||||||||||||||||||
| 995 | # | ||||||||||||||||||||||||||||||||||||||||||
| 996 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 997 | # pages ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 998 | # sitemap ptr | ||||||||||||||||||||||||||||||||||||||||||
| 999 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | # returns: html string, xml string | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | sub sitemap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sitemap: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | my($specs,$pp,$sm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | my $html = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | ▶ | my $port = $ENV{SERVER_PORT} || 80; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'SERVER_PORT'} || 80
MC/DC0%0/1
$ENV{'SERVER_PORT'} || 80
$ENV{'SERVER_PORT'}
Truth table0%0/2
A
A= $ENV{'SERVER_PORT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | $port = ($port == 80) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | ? '' : ':'. $port; | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | ▶ | my $srvr = $ENV{SERVER_NAME} || 'WebScaffoldText'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'SERVER_NAME'} || 'WebScaffoldText'
MC/DC0%0/1
$ENV{'SERVER_NAME'} || 'WebScaffoldText'
$ENV{'SERVER_NAME'}
Truth table0%0/2
A
A= $ENV{'SERVER_NAME'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1009 | 0 | my $xml = q|<?xml version="1.0" encoding="UTF-8"?> | |||||||||||||||||||||||||||||||||||||||||
| 1010 | <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | my $now = xmltime(time); | |||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | my $mtime = (stat($specs->{pagedir}))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 1018 | 0 | $mtime = xmltime($mtime); | |||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | my $cf = $specs->{changefreq}; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | foreach (@{$specs->{'_sm'}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | my($tab,$page) = @{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | ▶ | while (0 < $tab--) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | $html .= ' '; | |||||||||||||||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | my($sep,$pg,$txt,$m) = @{$sm->{$page}}; | |||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | $m = 0 unless $m; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | my $ftime = xmltime($m); | |||||||||||||||||||||||||||||||||||||||||
| 1029 | #print "SEP='$sep' PG='$pg' TXT='$txt'\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | # generate html | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | $html .= 'LINK<'. $sep . $pg . $sep . $txt . $sep . $txt ."><br>\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1033 | # generate xml | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | $xml .= q|<url> | |||||||||||||||||||||||||||||||||||||||||
| 1035 | <loc>http://|. $srvr . $port; | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | ▶ | if (exists $pp->{$pg}) { # if this is a scaffold page | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1037 | 0 | $xml .= q|/index.shtml?page=|. $pg .q|</loc>|; | |||||||||||||||||||||||||||||||||||||||||
| 1038 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | ▶ | if ($pg =~ m|^/|) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | $pg = $'; | |||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | $xml .= '/'. $pg . q|</loc>|; | |||||||||||||||||||||||||||||||||||||||||
| 1043 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | $xml .= q| | |||||||||||||||||||||||||||||||||||||||||
| 1045 | <lastmod>|. $ftime .q|</lastmod> | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | <changefreq>|. $cf .q|</changefreq> | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | </url> | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | $xml .= q|</urlset> | |||||||||||||||||||||||||||||||||||||||||
| 1051 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | $html = fixLINKs($pp,$html); | |||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | return ($html,$xml); | |||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | # check and update the sitemap | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | # page ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | # returns: sitemap structure pointer | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | # else false | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | # writes htxt and xml pages if needed | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | ▶ | sub updsitemap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
updsitemap: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | my($specs,$pages,$pgt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1067 | return undef unless exists $specs->{sitemapdir} && # no update required, no sitemap | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | -e $specs->{sitemapdir} && | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | ▶ | -w $specs->{sitemapdir}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $specs->{"sitemapdir"} and -e $specs->{"sitemapdir"} and -w $specs->{"sitemapdir"}
exists $specs->{"sitemapdir"} and -e $specs->{"sitemapdir"}
MC/DC0%0/3
exists $specs->{"sitemapdir"} and -e $specs->{"sitemapdir"} and -w $specs->{"sitemapdir"}
exists $specs->{"sitemapdir"}
-e $specs->{"sitemapdir"}
-w $specs->{"sitemapdir"}
Truth table0%0/4
A and B and C
A= exists $specs->{"sitemapdir"}B= -e $specs->{"sitemapdir"}C= -w $specs->{"sitemapdir"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | my $smt = 0; # trial sitemap timestamp | |||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | my $smf = $specs->{sitemapdir} .'sitemap.xml'; | |||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | ▶ | if (-e $smf) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | $smt = (stat($smf))[9]; | |||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | ▶ | return undef if $pgt <= $smt; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | local(*LOCK, *F); | |||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | my $perms = 0644; | |||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | my $oldmask = umask 022; | |||||||||||||||||||||||||||||||||||||||||
| 1080 | 0 | ▶ | unless (sysopen LOCK, $smf .'.lock', O_RDWR|O_CREAT|O_TRUNC, $perms) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | umask $oldmask; | |||||||||||||||||||||||||||||||||||||||||
| 1082 | 0 | $! = 11; # 11 Resource temporarily unavailable | |||||||||||||||||||||||||||||||||||||||||
| 1083 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | 0 | umask $oldmask; | |||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | ▶ | unless (flock(LOCK, LOCK_EX())) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | close LOCK; | |||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1089 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | # build the sitemap structure | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | my $sm = sitestruct($specs,$pages); | |||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||
| 1094 | # build the html and xml text | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | my($htext,$xtext) = sitemap($specs,$pages,$sm); | |||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | # write the files | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | if (open(F,'>'. $smf .'.tmp')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | print F $xtext; | |||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | close F; | |||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | rename $smf .'.tmp', $smf; # atomic update | |||||||||||||||||||||||||||||||||||||||||
| 1102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1103 | 0 | $smf = $specs->{sitemapdir} .'sitemap.htxt'; | |||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | ▶ | if (open(F,'>'. $smf .'.tmp')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1105 | 0 | print F $htext; | |||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | close F; | |||||||||||||||||||||||||||||||||||||||||
| 1107 | 0 | rename $smf .'.tmp', $smf; | |||||||||||||||||||||||||||||||||||||||||
| 1108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | flock(LOCK,LOCK_UN()); | |||||||||||||||||||||||||||||||||||||||||
| 1110 | 0 | close LOCK; | |||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||
| 1113 | # generate the structure of the site map, human readable | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | # input: specs ptr, | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | # sitemap ptr | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | # returns: text | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | sub debugstruct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debugstruct: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | my($specs,$sm) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | my $txt = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | foreach (@{$specs->{'_sm'}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | my($tab,$page) = @{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | ▶ | while (0 < $tab--) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | $txt .= ' '; | |||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | $txt .= "@{$sm->{$page}}\n" | |||||||||||||||||||||||||||||||||||||||||
| 1129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | return $txt; | |||||||||||||||||||||||||||||||||||||||||
| 1131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||||||||||||
| 1133 | # generate the sitemap contents, not ordered, human readable | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1135 | # input: sitemap ptr | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | # returns: text | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | ▶ | sub debugsmap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debugsmap: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | my $sitemap = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | my $txt = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1142 | 0 | foreach (sort keys %$sitemap) { | |||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | my @ary = @{$sitemap->{$_}}; | |||||||||||||||||||||||||||||||||||||||||
| 1144 | 0 | $txt .= "$_\t => @ary\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||
| 1149 | ## generate sitemap hash | ||||||||||||||||||||||||||||||||||||||||||
| 1150 | #my $sm = sitestruct(\%specs,\%pages); | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||
| 1153 | #my ($htext,$xtext) = sitemap(\%specs,\%pages,$sm); | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||
| 1155 | #print $htext,"\n\n",$xtext; | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | #print debugstruct(\%specs,$sm); | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||
| 1158 | # checkspecs(\%specs); | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||
| 1160 | #if (updsitemap(\%specs,\%pages)) { | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | # print "DONE\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | #} else { | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | # print "NOTHING\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | #delete $specs{_sm}; | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | #delete $specs{_tab}; | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||||||||||||||||
| 1168 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | __END__ | ||||||||||||||||||||||||||||||||||||||||||