| 1 | package HTML::WTweb; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # WAYCALL TOOL web | ||||||||||||||||||||
| 4 | # 20043112 | ||||||||||||||||||||
| 5 | # Gm Gamboni | ||||||||||||||||||||
| 6 | # | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 1 | $VERSION = 0.01; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 0 | ▶ | sub new{ | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 14 | 0 | my $self = shift; | |||||||||||||||||||
| 15 | 0 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 0 | my %VARS = (); | |||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | my $this = {}; | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 0 | $this->{DEBUG} = 0; # 0 debug off != 0 debug on | |||||||||||||||||||
| 22 | 0 | $this->{HTMLDIR}; | |||||||||||||||||||
| 23 | 0 | $this->{HYPER_PTR}; | |||||||||||||||||||
| 24 | 0 | $this->{F_POS}; | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | bless $this, $class; | |||||||||||||||||||
| 29 | 0 | return $this; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 0 | ▶ | sub processhtml{ | ||||||||||||||||||
|
Subroutine
processhtml: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||
| 34 | 0 | my $this = shift; | |||||||||||||||||||
| 35 | 0 | my %params = @_; | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | my $fname = $params{'FileName'}; | |||||||||||||||||||
| 38 | 0 | my $prhdr = $params{'Header'}; | |||||||||||||||||||
| 39 | 0 | ▶ | if($fname){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | 0 | delete ($params{'FileName'}); | |||||||||||||||||||
| 41 | }else{ | ||||||||||||||||||||
| 42 | 0 | die "No filename Given\n"; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | 0 | ▶ | if($prhdr){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | 0 | print "Content-Type: text/html\n\n"; | |||||||||||||||||||
| 46 | 0 | delete($params{'Header'}); | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | 0 | $this->{F_POS} = $this->fileseek($fname); | |||||||||||||||||||
| 49 | 0 | my $alen = $this->{HYPER_PTR}; | |||||||||||||||||||
| 50 | 0 | my $acpy = @$alen[$this->{F_POS}]; | |||||||||||||||||||
| 51 | 0 | my $ac; | |||||||||||||||||||
| 52 | my @ary; | ||||||||||||||||||||
| 53 | 0 | foreach my $lc(@$acpy){ push(@ary, $lc)}; | |||||||||||||||||||
| 54 | 0 | shift(@ary); | |||||||||||||||||||
| 55 | 0 | foreach $ac(@ary){ | |||||||||||||||||||
| 56 | 0 | ▶ | while((my $key, my $value) = each(%params)){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | 0 | $ac =~ s/$key/$value/g; | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | 0 | print $ac; | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 0 | ▶ | sub fileseek{ | ||||||||||||||||||
|
Subroutine
fileseek: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 64 | 0 | my $this = shift; | |||||||||||||||||||
| 65 | 0 | my $fts = shift; | |||||||||||||||||||
| 66 | 0 | my $cnt = 0; | |||||||||||||||||||
| 67 | 0 | my $alen = $this->{HYPER_PTR}; | |||||||||||||||||||
| 68 | 0 | foreach my $ar(@$alen){ | |||||||||||||||||||
| 69 | 0 | ▶ | return $cnt if(@$ar[0] =~ /$fts/); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 70 | 0 | $cnt++ | |||||||||||||||||||
| 71 | } | ||||||||||||||||||||
| 72 | 0 | return -1; | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 0 | ▶ | sub sethtmldir{ | ||||||||||||||||||
|
Subroutine
sethtmldir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 76 | 0 | my $this= shift; | |||||||||||||||||||
| 77 | 0 | my $dir = shift; | |||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | # Debug - expression validate input | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 0 | $this->{HTMLDIR} = $dir; | |||||||||||||||||||
| 82 | 0 | return 1; | |||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 0 | ▶ | sub fileload{ | ||||||||||||||||||
|
Subroutine
fileload: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 86 | 0 | my $this = shift; | |||||||||||||||||||
| 87 | 0 | my @filenames = @_; | |||||||||||||||||||
| 88 | 0 | ▶ | return -1 unless @filenames; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 89 | 0 | my($cnt,@HYPER); | |||||||||||||||||||
| 90 | 0 | foreach my $file(@filenames){ | |||||||||||||||||||
| 91 | 0 | ▶ | open(FH, "<$this->{HTMLDIR}/$file")or return 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 92 | 0 | my @lines = <FH>; | |||||||||||||||||||
| 93 | 0 | close FH; | |||||||||||||||||||
| 94 | 0 | unshift(@lines, $file); | |||||||||||||||||||
| 95 | 0 | $HYPER[$cnt] = \@lines, | |||||||||||||||||||
| 96 | $cnt++; | ||||||||||||||||||||
| 97 | } | ||||||||||||||||||||
| 98 | 0 | $this->{HYPER_PTR}= \@HYPER; | |||||||||||||||||||
| 99 | 0 | return 1; | |||||||||||||||||||
| 100 | } | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | # NOT IMPLEMENTED YET # | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | 0 | ▶ | sub prv_parse{ | ||||||||||||||||||
|
Subroutine
prv_parse: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 105 | 0 | my @line = @_; | |||||||||||||||||||
| 106 | 0 | print "INIT--------------------\n"; | |||||||||||||||||||
| 107 | 0 | foreach my $l(@line){ | |||||||||||||||||||
| 108 | 0 | print "$l"; | |||||||||||||||||||
| 109 | 0 | ▶ | if($l =~ /(_\w+_)/){ | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 110 | 0 | print "Var: $1\n"; | |||||||||||||||||||
| 111 | } | ||||||||||||||||||||
| 112 | } | ||||||||||||||||||||
| 113 | 0 | print "END--------------------\n"; | |||||||||||||||||||
| 114 | } | ||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | 1 | 1; | |||||||||||||||||||
| 119 | __END__ | ||||||||||||||||||||