« auto/share/dist/Nes/cgi-bin/obj/Nes/form/multi_step.pl
↑ Summary
auto/share/dist/Nes/cgi-bin/plugin/captcha_plugin.pm »
| 1 | |||||||||||||||||||||||||||||||||||||||||||
| 2 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Nes by Skriptke | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # Copyright 2009 - 2010 Enrique Castañón | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Licensed under the GNU GPL. | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # CPAN: | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # http://search.cpan.org/dist/Nes/ | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # Sample: | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # http://nes.sourceforge.net/ | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # Repository: | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # http://github.com/Skriptke/nes | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # Version 1.03 | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # Nes.pm | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | #use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | # cgi environment no defined in command line | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | our $VERSION = '1.03'; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | our $CRLF = "\015\012"; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | our $MAX_INTERACTIONS = 500; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | our $MOD_PERL = $ENV{'MOD_PERL'} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'MOD_PERL'} || 0
MC/DC0%0/1
$ENV{'MOD_PERL'} || 0
$ENV{'MOD_PERL'}
Truth table50%1/2
A
A= $ENV{'MOD_PERL'}
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | our $MOD_PERL1 = $MOD_PERL =~ /mod_perl\/1/ || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$main::MOD_PERL =~ m[mod_perl/1] || 0
MC/DC0%0/1
$main::MOD_PERL =~ m[mod_perl/1] || 0
$main::MOD_PERL =~ m[mod_perl/1]
Truth table50%1/2
A
A= $main::MOD_PERL =~ m[mod_perl/1]
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | our $MOD_PERL2 = $MOD_PERL =~ /mod_perl\/2/ || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$main::MOD_PERL =~ m[mod_perl/2] || 0
MC/DC0%0/1
$main::MOD_PERL =~ m[mod_perl/2] || 0
$main::MOD_PERL =~ m[mod_perl/2]
Truth table50%1/2
A
A= $main::MOD_PERL =~ m[mod_perl/2]
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | use Nes::Setting; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | ▶ | use Nes::Singleton; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | package Nes; | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 5 | my %instance; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 28 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 28 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 28 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 28 | $self->{'previous'} = $class->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 28 | $instance{$class} = $self; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # utl::cleanup(\%instance) if $ENV{'MOD_PERL'}; | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 28 | $self->{'top_container'} = nes_top_container->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 54 | 28 | $self->{'CFG'} = Nes::Setting->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 55 | 28 | $self->{'cookies'} = nes_cookie->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 56 | 28 | $self->{'session'} = nes_session->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 57 | 28 | $self->{'query'} = nes_query->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 58 | 28 | $self->{'container'} = nes_container->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 28 | $self->{'register'} = nes_register->get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 60 | 28 | $self->{'nes'} = $self; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 28 | $self->{'MAX_INTERACTIONS'} = $MAX_INTERACTIONS; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 28 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 212 | ▶ | sub get_obj { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_obj: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 212 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 212 | my $class = ref($self); | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 212 | ▶ | $self = $instance{$self} if !$class; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 212 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub forget { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
forget: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $class = ref($self); | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $instance{$class} = $self->{'previous'}; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | return $instance{$class}; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub get_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_key: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my ($max) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my @kletters = @{ $self->{'CFG'}{'kletters'} }; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my @kletnum = @{ $self->{'CFG'}{'kletnum'} }; | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | # siempre comienza por letra por si se usa como nombre de variable o campo | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $key = $kletters[ int( rand( $#kletters + 1 ) ) ]; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | for ( 1 .. ( $max - 1 ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | $key .= $kletnum[ int( rand( $#kletnum + 1 ) ) ]; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | return $key; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 5 | package nes_tmp; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my ($suffix,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->{'suffix'} = $suffix; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $self->{'tmp_suffix'} = $self->{'CFG'}{'tmp_suffix'}; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $self->{'name'} = $self->get_name($name); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $self->{'tmp_dir'} = $self->{'CFG'}{'tmp_dir'}; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $self->{'file'} = $self->{'tmp_dir'}.'/'.$self->{'name'}; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $self->{'expired'} = utl::expires_time($self->{'CFG'}{'tmp_clear'}); | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | $self->clear_expired if $self->{'CFG'}{'tmp_clear'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub clear_expired { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_expired: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | # borra de vez en cuando los temporales ( 1 de cada rand x veces ) | ||||||||||||||||||||||||||||||||||||||||||
| 130 | # si hay muchos puede ser lento, sólo será lento una de cada rand x veces | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | return if 1 < (rand 100); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | # -------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 134 | # si por error en el archivo de configuración se hace: tmp_dir = '/' | ||||||||||||||||||||||||||||||||||||||||||
| 135 | # podía ser desastroso... de ahí tantas comprobaciones antes de borrar | ||||||||||||||||||||||||||||||||||||||||||
| 136 | # Indicar 0 en tmp_clear del archivo de configuración para no borrar nunca. | ||||||||||||||||||||||||||||||||||||||||||
| 137 | # -------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | # nos aseguramos que tmp_dir tiene valor | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # la ruta más corta es /tmp | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | return if length $self->{'tmp_dir'} < 4; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | # nos aseguramos que tmp_suffix tiene valor | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | return if length $self->{'tmp_suffix'} < 4; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | opendir(DIR,$self->{'tmp_dir'}); | |||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | foreach my $file (readdir(DIR)) { | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if ( $file =~ /$self->{'tmp_suffix'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | # nos aseguramos que sea un archivo temporal | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | next if $file !~ /tmp/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $last_mod = (stat ($self->{'tmp_dir'}.'/'.$file))[10]; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | unlink($self->{'tmp_dir'}.'/'.$file) if ( (time - $last_mod) > $self->{'expired'} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | closedir DIR; | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub save { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my ($data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ( ! -d $self->{'tmp_dir'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my @level = split('/',$self->{'tmp_dir'}); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $dir; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | foreach my $this_level ( @level ) { | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $dir .= '/'.$this_level; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | mkdir $dir if ! -d $dir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if ( ! -d $dir ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | warn "Can't create tmp dir : $dir"; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | open(my $fh,'>>',$self->{'file'}) or warn "Can't write tmp file : $self->{'file'}"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | print $fh $data,"\n"; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | return if ! -e $self->{'file'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | open(my $fh, '<', $self->{'file'}) or warn "Can't read tmp file : $self->{'file'}"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my @data = <$fh>; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | chomp @data; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | return @data; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | sub clear { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my ($data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | return if ! -e $self->{'file'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | open(my $fh,'>',$self->{'file'}) or warn "Can't write tmp file : $self->{'file'} $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | print $fh $data."\n" if $data; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | sub get_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_name: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my ($name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $remote = $ENV{'REMOTE_ADDR'}; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | $remote = $ENV{'HTTP_X_REMOTE_ADDR'} if $ENV{'HTTP_X_REMOTE_ADDR'} && ( !$remote || $remote =~ /^(127|192)\./); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$ENV{"HTTP_X_REMOTE_ADDR"} and !$remote || $remote =~ /^(127|192)\./
not $remote or $remote =~ /^(127|192)\./
MC/DC0%0/3
$ENV{"HTTP_X_REMOTE_ADDR"} and !$remote || $remote =~ /^(127|192)\./
$ENV{"HTTP_X_REMOTE_ADDR"}
not $remote
$remote =~ /^(127|192)\./
Truth table0%0/4
A and not(B) or C
A= $ENV{"HTTP_X_REMOTE_ADDR"}B= not $remoteC= $remote =~ /^(127|192)\./
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $name .= '.ip.'.$remote.$self->{'suffix'}.$self->{'tmp_suffix'}; | |||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | return $name; | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | { | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 5 | package nes_register; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 3 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | sub set_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_data: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my ($class, $name, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->{'data'}{$class}{$name} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub get_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_data: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my ($class, $name, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return $self->{'data'}{$class}{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | sub tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tag: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my ($class, $tag, $handler) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $self->{'tag'}{$tag}{'handler'} = $handler; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $self->{'obj'}{$class}{'tag'}{$tag} = $handler; | |||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handler: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my ($class, $name_handler, $handler) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->{'obj'}{'handler'}{$class}{$name_handler} = $handler; | |||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub add_obj { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_obj: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my ($class, $name, $obj) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | my $cfg_file = $self->{'CFG'}{'plugin_top_dir'}.'/.'.$class.'.nes.cfg'; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | Nes::Setting->load_cfg($cfg_file); | |||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $self->{'obj'}{$class}{$name} = $obj; | |||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my ($class, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | return $self->{'obj'}{$class}{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | sub get_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tags: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | return keys %{ $self->{'tag'} }; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub get_plugins { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_plugins: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | return keys %{ $self->{'obj'} }; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub get_names { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_names: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | return keys %{ $self->{'obj'}{$class} }; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | sub get_tag_class { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tag_class: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | my ($tag) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | return $self->{'tag'}{$tag}{'class'}; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub get_tag_handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tag_handler: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my ($tag) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return \&{$self->{'tag'}{$tag}{'handler'}}; | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | sub get_handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_handler: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | my ($class, $name_handler) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | return \&{$self->{'obj'}{'handler'}{$class}{$name_handler}}; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | sub add_last_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_last_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my ($class, $name, $error) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_error_last', $error ); | |||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | sub add_fatal_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_fatal_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my ($class, $name, $ok) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_error_fatal', $ok ); | |||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | sub add_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my ($class, $name, $type, $error) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_error_'.$type, $error ); | |||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub add_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_env: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my ($class, $name, $type, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_'.$type, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | # obsoleto, se mantiene por compatibilidad | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 5 | package nes_plugin; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 5 | my %instance = (); | |||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my ( $obj_class, $name, $obj ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | # utl::cleanup(\%instance) if $ENV{'MOD_PERL'}; | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $self->{'plugin'} = $obj_class; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $self->{'obj'}{$name} = $obj; | |||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my $cfg_file = $self->{'CFG'}{'plugin_top_dir'} . '/.' . $name . '.nes.cfg'; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | Nes::Setting->load_cfg($cfg_file); | |||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $instance{$obj_class} = $self; | |||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | # add object for this class | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | sub add_obj { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_obj: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my ($name, $obj) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $self->{'obj'}{$name} = $obj; | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | return $obj; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub add_last_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_last_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my ($class, $name, $error) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_error_last', $error ); | |||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | sub add_fatal_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_fatal_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | my ($class, $name, $ok) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_error_fatal', $ok ); | |||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | sub add_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my ($class, $name, $type, $error) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_error_'.$type, $error ); | |||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | sub add_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_env: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my ($class, $name, $type, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $self->{'top_container'}->set_nes_env( 'nes_'.$class.'_'.$name.'_'.$type, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | my ($class, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | return $instance{$class}->{'obj'}{$name} if $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return $instance{$class}->{'obj'}{$class}; | |||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | sub get_obj { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_obj: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | return $instance{$class} if $class; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | return $self->SUPER::get_obj(); | |||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | { | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 5 | package nes_cookie; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 6 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 6 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 473 | 6 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 6 | $self->get_user_cookies(); | |||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 6 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 2 | ▶ | sub get_cookies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cookies: called CC=5 SCAR=20.1
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | my @cookies; | |||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | # primero las que borran, para no machacar las que valen | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 2 | foreach my $cookie ( keys %{ $self->{'c_set'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | push( @cookies, $cookie ) if $cookie =~ /_delete$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 2 | foreach my $cookie ( keys %{ $self->{'c_set'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | push( @cookies, $cookie ) if $cookie !~ /_delete$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | 2 | return @cookies; | |||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 3 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=3 SCAR=18.8
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 498 | 3 | my ( $name, $pass ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | 3 | ▶ | return if !$self->{'c_get'}{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | $pass = '' if !$pass; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | my $key = $self->{'CFG'}{'private_key'} . $pass; | |||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | require Crypt::CBC; | |||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my $cipher = Crypt::CBC->new( | |||||||||||||||||||||||||||||||||||||||||
| 506 | -key => $key, | ||||||||||||||||||||||||||||||||||||||||||
| 507 | -cipher => 'Blowfish' | ||||||||||||||||||||||||||||||||||||||||||
| 508 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my $text = ''; | |||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | eval { $text = $cipher->decrypt_hex( $self->{'c_get'}{$name} ); }; | |||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | sub create { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | my ( $name, $value, $expiration, $path, $domain, $pass ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | $pass = '' if !$pass; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my $expires = &utl::expires($expiration); | |||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | my $key = $self->{'CFG'}{'private_key'} . $pass; | |||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | require Crypt::CBC; | |||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | my $cipher = Crypt::CBC->new( | |||||||||||||||||||||||||||||||||||||||||
| 525 | -key => $key, | ||||||||||||||||||||||||||||||||||||||||||
| 526 | -cipher => 'Blowfish' | ||||||||||||||||||||||||||||||||||||||||||
| 527 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | $value = $cipher->encrypt_hex($value); | |||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | $path = '/' if !$path; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $self->{'c_set'}{$name} = "Set-Cookie: $name=$value; expires=$expires; path=$path; "; | |||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | $self->{'c_set'}{$name} .= "domain=$domain; " if $domain; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | sub del { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | my ($name,$path) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | $path = '/' if !$path; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | my $expires = &utl::expires('1s'); | |||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my $value = 'deleted'; | |||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $self->{'c_set'}{ $name . '_delete' } = "Set-Cookie: $name=$value; expires=$expires; path=$path; "; | |||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | 6 | ▶ | sub get_user_cookies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_user_cookies: called CC=5 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 6 | ▶ | return if !$ENV{'HTTP_COOKIE'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | my @cookies = split( /[;,]\s*/, $ENV{'HTTP_COOKIE'} ); | |||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | foreach my $cookie (@cookies) { | |||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | my ( $key, $value ) = split( /=/, $cookie ); | |||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | $value = '' if !$value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | next if $value eq 'deleted'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $self->{'c_get'}{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 2 | ▶ | sub out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
out: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 2 | my $cookies = ''; | |||||||||||||||||||||||||||||||||||||||||
| 569 | 2 | foreach my $cookie ( $self->get_cookies() ) { | |||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | $cookies .= $self->{'c_set'}{$cookie}."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | 2 | return $cookies; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | sub get_c_get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_c_get: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | my @cookies; | |||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | foreach my $cookie ( keys %{ $self->{'c_get'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | push( @cookies, $cookie ); | |||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | return @cookies; | |||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | { | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 5 | package nes_session; | |||||||||||||||||||||||||||||||||||||||||
| 594 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 5 | @ISA = qw( nes_cookie ); | |||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 599 | 3 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 3 | $self->{'session_prefix'} = $self->{'CFG'}{'session_prefix'}; | |||||||||||||||||||||||||||||||||||||||||
| 602 | 3 | $self->{'session_ok'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 3 | $self->{'user'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 604 | 3 | $self->get; | |||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | 3 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=5 SCAR=24.2
| |||||||||||||||||||||||||||||||||||||||||||
| 610 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 611 | 3 | ▶ | my ($pass) = @_ || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
@_ || ''
MC/DC0%0/1
@_ || ''
@_
Truth table50%1/2
A
A= @_
| |||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | 3 | my $key = $self->{'CFG'}{'private_key'} . $pass; | |||||||||||||||||||||||||||||||||||||||||
| 614 | 3 | $self->{'sess'} = $self->SUPER::get( $self->{'session_prefix'}, $key ); | |||||||||||||||||||||||||||||||||||||||||
| 615 | 3 | ▶ | return if !$self->{'sess'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | my ( $session_name, $expire, $user, $refuse ) = split( /::/, $self->{'sess'} ); | |||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | return if time > $expire; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | return if $session_name ne $self->{'session_prefix'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | $self->{'session_ok'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | $self->{'user'} = $user; | |||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | return $user; | |||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | sub create { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | my ( $user, $expiration, $pass ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | $pass = '' if !$pass; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | my $key = $self->{'CFG'}{'private_key'} . $pass; | |||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $expire = time + utl::expires_time( $expiration ); | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | my $refuse = $self->get_key( 10 + int rand 10 ); | |||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | my $value = $self->{'session_prefix'} . '::' . $expire . '::' . $user . '::' . $refuse; | |||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | my $path = '/'; | |||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | $self->{'cookies'}->create( $self->{'session_prefix'}, $value, $expiration, $path,'',$key ); | |||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | sub del { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||
| 647 | 0 | ▶ | return if !$self->{'user'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $self->{'cookies'}->del( $self->{'session_prefix'} ); | |||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | { # todo, add "<SELET MULTIPLE>" support | ||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | 5 | package nes_query; | |||||||||||||||||||||||||||||||||||||||||
| 659 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=37.7
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 664 | 3 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||
| 666 | 3 | $self->{'q'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 667 | 3 | ▶ | my $clength = $ENV{'CONTENT_LENGTH'} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'CONTENT_LENGTH'} || 0
MC/DC0%0/1
$ENV{'CONTENT_LENGTH'} || 0
$ENV{'CONTENT_LENGTH'}
Truth table50%1/2
A
A= $ENV{'CONTENT_LENGTH'}
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 3 | $self->{'save_buffer'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 3 | ▶ | return $self if !$clength && !$ENV{'QUERY_STRING'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$clength or $ENV{"QUERY_STRING"}
MC/DC0%0/2
$clength or $ENV{"QUERY_STRING"}
$clength
$ENV{"QUERY_STRING"}
Truth table33%1/3
A or B
A= $clengthB= $ENV{"QUERY_STRING"}
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | require Nes::Minimal; | |||||||||||||||||||||||||||||||||||||||||
| 673 | $self->{'save_buffer'} = 1 if $self->{'top_container'}->{'php_wrapper'} && | ||||||||||||||||||||||||||||||||||||||||||
| 674 | $clength > ($self->{'CFG'}{'tmp_upload'}*1024) && | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | $self->{'CFG'}{'tmp_upload'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"top_container"}{"php_wrapper"} and $clength > $self->{"CFG"}{"tmp_upload"} * 1024 and $self->{"CFG"}{"tmp_upload"}
$self->{"top_container"}{"php_wrapper"} and $clength > $self->{"CFG"}{"tmp_upload"} * 1024
MC/DC0%0/3
$self->{"top_container"}{"php_wrapper"} and $clength > $self->{"CFG"}{"tmp_upload"} * 1024 and $self->{"CFG"}{"tmp_upload"}
$self->{"top_container"}{"php_wrapper"}
$clength > $self->{"CFG"}{"tmp_upload"} * 1024
$self->{"CFG"}{"tmp_upload"}
Truth table0%0/4
A and B and C
A= $self->{"top_container"}{"php_wrapper"}B= $clength > $self->{"CFG"}{"tmp_upload"} * 1024C= $self->{"CFG"}{"tmp_upload"}
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | Nes::Minimal::allow_hybrid_post_get(1); | |||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | Nes::Minimal::max_read_size( $self->{'CFG'}{'max_post'}*1024 ); | |||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | Nes::Minimal::use_tmp( $self->{'CFG'}{'tmp_upload'}*1024 ); | |||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | Nes::Minimal::max_upload( $self->{'CFG'}{'max_upload'}*1024 ); | |||||||||||||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | Nes::Minimal::save_buffer(1) if $self->{'save_buffer'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | Nes::Minimal::sub_filter( \&utl::no_nes_remove ) if $self->{'top_container'}->{'php_wrapper'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->{'CGI'} = Nes::Minimal->new; | |||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | $self->set_query(); | |||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | ▶ | sub set_query { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_query: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | foreach my $param ( $self->{'CGI'}->param() ) { | |||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | $self->{'q'}{$param} = $self->{'CGI'}->param($param); | |||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | sub param { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | my ($param) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | return $self->{'CGI'}->param($param); | |||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | # sub get_upload { | ||||||||||||||||||||||||||||||||||||||||||
| 706 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 707 | # my ($param,$buffer) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 708 | # | ||||||||||||||||||||||||||||||||||||||||||
| 709 | # my $fh = $self->{'CGI'}->upload($param); | ||||||||||||||||||||||||||||||||||||||||||
| 710 | # return if !$fh; | ||||||||||||||||||||||||||||||||||||||||||
| 711 | # | ||||||||||||||||||||||||||||||||||||||||||
| 712 | # return read($fh, $$buffer, 8192); | ||||||||||||||||||||||||||||||||||||||||||
| 713 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | 0 | ▶ | sub get_upload_buffer { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_upload_buffer: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 717 | 0 | my ($param,$buffer) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | my $fh = $self->{'CGI'}->upload($param); | |||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | return if !$fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | return read($fh, $$buffer, 8192); | |||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | ▶ | sub get_upload_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_upload_name: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | my ($param) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | return $self->{'CGI'}->param_filename($param); | |||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | sub get_upload_fh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_upload_fh: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | my ($param) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | return $self->{'CGI'}->upload($param); | |||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | sub upload_is_tmp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
upload_is_tmp: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my ($param) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | return $self->{'CGI'}->upload_is_tmp($param); | |||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | ▶ | sub upload_max_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
upload_max_size: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | return $self->{'CGI'}->upload_max_size(); | |||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | ▶ | sub post_max_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_max_size: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | return $self->{'CGI'}->post_max_size(); | |||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | sub url_encode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
url_encode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | return $self->{'CGI'}->url_encode($value); | |||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | sub url_decode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
url_decode: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | return $self->{'CGI'}->url_decode($value); | |||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | ▶ | sub get_buffer { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_buffer: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | return if !$self->{'CGI'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | if ( $ENV{'REQUEST_METHOD'} ne 'GET' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | return $buffer if $self->{'CGI'}->raw_saved(\$buffer, 8192); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | ▶ | sub get_buffer_raw { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_buffer_raw: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | return if !$self->{'CGI'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | ▶ | if ( $ENV{'REQUEST_METHOD'} ne 'GET' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | return $self->{'CGI'}->raw; | |||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | my ($key) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | # return $self->{'CGI'}->param($key); | ||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | return $self->{'q'}{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | my ( $name, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | $self->{'q'}{$name} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | sub del { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | my ( $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | undef $self->{'q'}{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | { | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | 5 | package nes_top_container; | |||||||||||||||||||||||||||||||||||||||||
| 829 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 833 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 834 | 3 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 835 | 3 | my ($file,$dir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | # maximo de interactiones, para evitar un bucle infinito. | ||||||||||||||||||||||||||||||||||||||||||
| 838 | 3 | $self->{'max_inter'} = $MAX_INTERACTIONS; | |||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||
| 840 | 3 | ▶ | $self->init($file,$dir) if $file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | 3 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 846 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 847 | 3 | my ($file,$dir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | 3 | $self->{'url'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 850 | 3 | $self->{'dir'} = $dir; | |||||||||||||||||||||||||||||||||||||||||
| 851 | 3 | $self->{'file'} = $file; | |||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||
| 853 | 3 | $self->set_parent_dir( $self->{'dir'} ); | |||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 3 | $self->{'file'} =~ s/(.*[\\\/])/\//; | |||||||||||||||||||||||||||||||||||||||||
| 856 | 3 | $self->{'file'} = $self->{'dir'} . $self->{'file'}; | |||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | 3 | ▶ | $self->{'php_wrapper'} = 1 if $self->{'file'} =~ /php$/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | 3 | $self->{'query'} = nes_query->new(); | |||||||||||||||||||||||||||||||||||||||||
| 861 | 3 | $self->{'cookies'} = nes_cookie->new(); | |||||||||||||||||||||||||||||||||||||||||
| 862 | 3 | $self->{'session'} = nes_session->new(); | |||||||||||||||||||||||||||||||||||||||||
| 863 | 3 | $self->{'register'} = nes_register->new(); | |||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||
| 865 | 3 | $self->init_nes_env(); | |||||||||||||||||||||||||||||||||||||||||
| 866 | 3 | $self->init_cgi_env(); | |||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | 3 | $self->{'container'} = nes_container->new( $self->{'file'} ); | |||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||
| 870 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | sub get_out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_out: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | return $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | ▶ | sub get_session { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_session: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | return $self->{'session'}; | |||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | sub get_query { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_query: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | return $self->{'query'}; | |||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | 5 | ▶ | sub get_file_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_path: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 892 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 893 | 5 | my ( $file ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | 5 | my $parent_dir = $self->get_parent_dir(); | |||||||||||||||||||||||||||||||||||||||||
| 896 | 5 | $parent_dir =~ s/\/$//; | |||||||||||||||||||||||||||||||||||||||||
| 897 | 5 | my $this_dir = $file; | |||||||||||||||||||||||||||||||||||||||||
| 898 | 5 | $this_dir =~ s/[^\/]*$//; | |||||||||||||||||||||||||||||||||||||||||
| 899 | 5 | $this_dir =~ s/^\.\///; | |||||||||||||||||||||||||||||||||||||||||
| 900 | 5 | my $this_file = $file; | |||||||||||||||||||||||||||||||||||||||||
| 901 | 5 | $this_file =~ s/(.*)(\\|\/)//; | |||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||
| 903 | 5 | my $file_path; | |||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||
| 905 | 5 | ▶ | if ( $this_dir =~ /^\// ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 906 | 3 | $self->{'this_dir'} = $this_dir; | |||||||||||||||||||||||||||||||||||||||||
| 907 | 3 | $file_path = $file; | |||||||||||||||||||||||||||||||||||||||||
| 908 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 909 | 2 | ▶ | while ( $this_dir =~ s/^\.\.\/// ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | $parent_dir =~ s/\/[^\/]*$//; | |||||||||||||||||||||||||||||||||||||||||
| 911 | } | ||||||||||||||||||||||||||||||||||||||||||
| 912 | 2 | $self->{'this_dir'} = $parent_dir.'/'.$this_dir; | |||||||||||||||||||||||||||||||||||||||||
| 913 | 2 | $file_path = $parent_dir.'/'.$this_dir.$this_file; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | # Insecure dependency in require while running with -T switch at | ||||||||||||||||||||||||||||||||||||||||||
| 917 | 5 | ▶ | if ($file_path =~ /^([-\@\w.\\\/]+)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 918 | 5 | $file_path = $1; | |||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||
| 921 | 5 | return $file_path; | |||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | sub get_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_dir: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | my ($file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | my $dir = $file; | |||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $dir =~ s/(.*)(\\|\/).*/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | return $dir; | |||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||
| 934 | 8 | ▶ | sub set_parent_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_parent_dir: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 935 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 936 | 8 | my ($dir) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||
| 938 | 8 | $self->{'parent_dir'} = $dir; | |||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||
| 940 | 8 | return $dir; | |||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||
| 943 | 8 | ▶ | sub get_parent_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_parent_dir: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 944 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | 8 | return $self->{'parent_dir'}; | |||||||||||||||||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||
| 949 | 3 | ▶ | sub init_nes_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_nes_env: called CC=8 SCAR=21.8
| |||||||||||||||||||||||||||||||||||||||||||
| 950 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 951 | 3 | my ( $var, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||
| 953 | 3 | foreach my $key ( keys %{ $self->{'query'}->{'q'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | my $name_env = 'q_' . $key; | |||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | my $value = $self->{'query'}->{'q'}{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | $self->{'nes_env'}{$name_env} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||
| 959 | 3 | foreach my $key ( keys %{ $self->{'CFG'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 960 | 114 | my $name_env = 'cfg_' . $key; | |||||||||||||||||||||||||||||||||||||||||
| 961 | 114 | my $value = $self->{'CFG'}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 962 | 114 | ▶ | $value = "@{$self->{'CFG'}->{$key}}" if ref $self->{'CFG'}->{$key} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 963 | 114 | ▶ | $value = keys %{$self->{'CFG'}->{$key}} if ref $self->{'CFG'}->{$key} eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 964 | 114 | $self->{'nes_env'}{$name_env} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||
| 967 | 3 | ( $self->{'nes_env'}{'nes_accept_language'} ) = split(/,/, $ENV{'HTTP_ACCEPT_LANGUAGE'}, 2); | |||||||||||||||||||||||||||||||||||||||||
| 968 | 3 | $self->{'nes_env'}{'nes_dir_self'} = $self->{'dir'}; | |||||||||||||||||||||||||||||||||||||||||
| 969 | 3 | $self->{'nes_env'}{'nes_this_dir'} = $self->{'dir'}; | |||||||||||||||||||||||||||||||||||||||||
| 970 | 3 | $self->{'nes_env'}{'nes_this_file'} = $self->{'file'}; | |||||||||||||||||||||||||||||||||||||||||
| 971 | 3 | $self->{'nes_env'}{'nes_ver'} = $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 972 | 3 | $self->{'nes_env'}{'nes_remote_ip'} = $ENV{'REMOTE_ADDR'}; | |||||||||||||||||||||||||||||||||||||||||
| 973 | $self->{'nes_env'}{'nes_remote_ip'} = $ENV{'HTTP_X_REMOTE_ADDR'} | ||||||||||||||||||||||||||||||||||||||||||
| 974 | 3 | ▶ | if $ENV{'HTTP_X_REMOTE_ADDR'} && ( !$ENV{'REMOTE_ADDR'} || $ENV{'REMOTE_ADDR'} =~ /^(127|192|169|10)\./); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$ENV{"HTTP_X_REMOTE_ADDR"} and !$ENV{"REMOTE_ADDR"} || $ENV{"REMOTE_ADDR"} =~ /^(127|192|169|10)\./
not $ENV{"REMOTE_ADDR"} or $ENV{"REMOTE_ADDR"} =~ /^(127|192|169|10)\./
MC/DC0%0/3
$ENV{"HTTP_X_REMOTE_ADDR"} and !$ENV{"REMOTE_ADDR"} || $ENV{"REMOTE_ADDR"} =~ /^(127|192|169|10)\./
$ENV{"HTTP_X_REMOTE_ADDR"}
not $ENV{"REMOTE_ADDR"}
$ENV{"REMOTE_ADDR"} =~ /^(127|192|169|10)\./
Truth table25%1/4
A and not(B) or C
A= $ENV{"HTTP_X_REMOTE_ADDR"}B= not $ENV{"REMOTE_ADDR"}C= $ENV{"REMOTE_ADDR"} =~ /^(127|192|169|10)\./
| |||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||
| 976 | 3 | $self->{'nes_env'}{'nes_session_ok'} = $self->{'session'}->{'session_ok'}; | |||||||||||||||||||||||||||||||||||||||||
| 977 | 3 | $self->{'nes_env'}{'nes_session_user'} = $self->{'session'}->{'user'}; | |||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||
| 979 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||
| 982 | 3 | ▶ | sub init_cgi_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_cgi_env: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 983 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 984 | 3 | my ( $var, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||
| 986 | 3 | foreach my $key ( keys %ENV ) { | |||||||||||||||||||||||||||||||||||||||||
| 987 | 102 | my $name_env = 'env_' . $key; | |||||||||||||||||||||||||||||||||||||||||
| 988 | 102 | my $value = $ENV{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 989 | 102 | $self->{'nes_env'}{$name_env} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||
| 992 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | ▶ | sub set_nes_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_nes_env: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | my ( $var, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | $self->{'nes_env'}{$var} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||
| 1001 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | ▶ | sub del_nes_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_nes_env: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1005 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | my ( $var ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | undef $self->{'nes_env'}{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | ▶ | sub get_nes_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_nes_env: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1014 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | my ($var) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | return $self->{'nes_env'}{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | 5 | package nes_container; | |||||||||||||||||||||||||||||||||||||||||
| 1027 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||
| 1030 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1031 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1032 | 3 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 1033 | 3 | my ( $file ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | 3 | $self->{'file_dir'} = $self->{'top_container'}->get_parent_dir(); | |||||||||||||||||||||||||||||||||||||||||
| 1036 | 3 | $self->{'file_name'} = $self->{'top_container'}->get_file_path($file); | |||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||
| 1038 | 3 | $self->{'top_container'}->set_parent_dir($self->{'top_container'}->{'this_dir'}); | |||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||
| 1040 | 3 | ▶ | $self->{'top_container'}->{'max_inter'}-- || die "Possible infinite loop"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1041 | 3 | $self->{'this_inter'} = $MAX_INTERACTIONS - $self->{'top_container'}->{'max_inter'}; | |||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | 3 | $self->{'souce_types'}{'unknown'} = 'unknown'; | |||||||||||||||||||||||||||||||||||||||||
| 1044 | 3 | $self->{'souce_types'}{'html'} = 'html,htm,nhtm,nhtml'; | |||||||||||||||||||||||||||||||||||||||||
| 1045 | 3 | $self->{'souce_types'}{'nsql'} = 'nsql'; | |||||||||||||||||||||||||||||||||||||||||
| 1046 | 3 | $self->{'souce_types'}{'php'} = 'php'; | |||||||||||||||||||||||||||||||||||||||||
| 1047 | 3 | $self->{'souce_types'}{'perl'} = 'pl'; | |||||||||||||||||||||||||||||||||||||||||
| 1048 | 3 | $self->{'souce_types'}{'txt'} = 'txt'; | |||||||||||||||||||||||||||||||||||||||||
| 1049 | 3 | $self->{'souce_types'}{'bash'} = 'sh'; | |||||||||||||||||||||||||||||||||||||||||
| 1050 | 3 | $self->{'souce_types'}{'python'} = 'py'; | |||||||||||||||||||||||||||||||||||||||||
| 1051 | 3 | $self->{'souce_types'}{'js'} = 'njs,js'; | |||||||||||||||||||||||||||||||||||||||||
| 1052 | #$self->{'souce_types'}{'mail'} = 'eml'; | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||
| 1055 | 3 | $self->get_source(); # set @{$self->{'file_souce'}} | |||||||||||||||||||||||||||||||||||||||||
| 1056 | 3 | $self->set_out(); # set $self->{'file_script'}, $self->{'out'} | |||||||||||||||||||||||||||||||||||||||||
| 1057 | 3 | $self->get_type(); # set $self->{'type'}, $self->{'content_obj'} | |||||||||||||||||||||||||||||||||||||||||
| 1058 | 3 | $self->add_parent_tags(); # hereda los tags | |||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||
| 1060 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||
| 1063 | 3 | ▶ | sub get_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_type: called CC=11 SCAR=37.5
| |||||||||||||||||||||||||||||||||||||||||||
| 1064 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||
| 1066 | 3 | my $extension = $self->{'file_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 1067 | 3 | $extension =~ s/(.*)\.([^\.]*)$/$2/; | |||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||
| 1069 | 3 | $self->{'type'} = 'unknown'; | |||||||||||||||||||||||||||||||||||||||||
| 1070 | 3 | foreach my $type ( keys %{ $self->{'souce_types'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 1071 | 27 | ▶ | $self->{'type'} = $type if $self->{'souce_types'}{$type} =~ /[\,\s]?$extension[\,\s]?/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | 3 | ▶ | if ( $self->{'type'} eq 'html' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1075 | 3 | $self->{'content_obj'} = nes_html->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | } elsif ( $self->{'type'} eq 'nsql' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | $self->{'content_obj'} = nes_nsql->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||
| 1080 | } elsif ( $self->{'type'} eq 'php' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | $self->{'content_obj'} = nes_php->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | } elsif ( $self->{'type'} eq 'perl' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | $self->{'content_obj'} = nes_perl->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||
| 1086 | } elsif ( $self->{'type'} eq 'txt' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | $self->{'content_obj'} = nes_txt->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||
| 1089 | } elsif ( $self->{'type'} eq 'bash' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | 0 | $self->{'content_obj'} = nes_shell->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1091 | |||||||||||||||||||||||||||||||||||||||||||
| 1092 | } elsif ( $self->{'type'} eq 'python' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | $self->{'content_obj'} = nes_python->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||
| 1095 | } elsif ( $self->{'type'} eq 'js' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | $self->{'content_obj'} = nes_js->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||
| 1098 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | 0 | $self->{'content_obj'} = nes_unknown->new( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 1100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | 3 | ▶ | sub get_source { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_source: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1106 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||||||||||||||||
| 1108 | 3 | ▶ | if ( open my $fh, '<', "$self->{'file_name'}" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1109 | 3 | @{ $self->{'file_souce'} } = <$fh>; | |||||||||||||||||||||||||||||||||||||||||
| 1110 | 3 | chomp $self->{'file_souce'}[$#{$self->{'file_souce'}}]; | |||||||||||||||||||||||||||||||||||||||||
| 1111 | 3 | close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 1112 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | warn "couldn't open $self->{'file_name'}"; | |||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | $self->{'top_container'}->set_nes_env( 'nes_error_file_not_exist', $self->{'file_name'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | sub add_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_tags: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | my (%tags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1123 | |||||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | $self->{'content_obj'}->add_tags(%tags); | |||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | 3 | ▶ | sub add_parent_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_parent_tags: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1130 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||
| 1132 | 3 | foreach my $tag ( keys %{ $self->{'previous'}->{'content_obj'}->{'tags'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | $self->{'content_obj'}->{'tags'}{$tag} = $self->{'previous'}->{'content_obj'}->{'tags'}{$tag}; | |||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1135 | |||||||||||||||||||||||||||||||||||||||||||
| 1136 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | ▶ | sub set_out_content { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_out_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1140 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | my ($out) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | 0 | $self->{'content_obj'}->set_out($out); | |||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||
| 1145 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | ▶ | sub get_out_content { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_out_content: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | return $self->{'content_obj'}->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | 3 | ▶ | sub set_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tags: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1155 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1156 | 3 | my (%tags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||
| 1158 | 3 | $self->{'content_obj'}->set_tags(%tags); | |||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||
| 1160 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | ▶ | sub get_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tag: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | my ($tag) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | return $self->{'content_obj'}->{'tags'}{$tag}; | |||||||||||||||||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||
| 1170 | 3 | ▶ | sub set_out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_out: called CC=8 SCAR=21.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1171 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||
| 1173 | $self->{'file_nes_line'} = $self->{'file_souce'}[0] | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | 3 | ▶ | if $self->{'file_souce'}[0] =~ /{:\s*NES/i || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{"file_souce"}[0] =~ /{:\s*NES/i or ""
MC/DC0%0/1
$self->{"file_souce"}[0] =~ /{:\s*NES/i or ""
$self->{"file_souce"}[0] =~ /{:\s*NES/i
Truth table50%1/2
A
A= $self->{"file_souce"}[0] =~ /{:\s*NES/i
| |||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | 3 | my $interpret = nes_interpret->new(); | |||||||||||||||||||||||||||||||||||||||||
| 1177 | 3 | my @param = $interpret->replace_NES( $self->{'file_nes_line'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||
| 1179 | 3 | ▶ | if ( $param[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1180 | 3 | shift @{ $self->{'file_souce'} }; # eliminamos la primera linea | |||||||||||||||||||||||||||||||||||||||||
| 1181 | 3 | $self->{'script_ver'} = shift @param; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | 3 | @{ $self->{'file_script'} } = @param; | |||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||
| 1185 | 3 | $self->{'out'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 3 | foreach my $line (@{$self->{'file_souce'}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1187 | 33 | $self->{'out'} .= $line; | |||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||
| 1190 | 3 | foreach my $script ( @{ $self->{'file_script'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 1191 | 3 | ▶ | $script = 'none' if !$script; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1192 | 3 | ▶ | next if $script eq 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||
| 1198 | 2 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||
| 1201 | 2 | $self->{'content_obj'}->go(); | |||||||||||||||||||||||||||||||||||||||||
| 1202 | 2 | $self->{'top_container'}->set_parent_dir($self->{'file_dir'}); | |||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||
| 1207 | 3 | ▶ | sub interpret { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
interpret: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1208 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | 3 | $self->{'content_obj'}->interpret(); | |||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | 1 | ▶ | sub get_out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_out: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1216 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||
| 1218 | 1 | return $self->{'content_obj'}->get_out(); | |||||||||||||||||||||||||||||||||||||||||
| 1219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | 2 | ▶ | sub out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
out: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1222 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | 2 | ▶ | if ( ! $self->{'content_obj'}->{'is_binary'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1225 | 2 | ▶ | while ( $self->{'content_obj'}->{'out'} =~ s/{:(\s*(\$|\*|\~|sql|\%|inc|\#|\&|nes).+?):}//gsio ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1226 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | # impedir que los tags con error o no reemplazados aparezcan en la salida | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | 2 | $self->{'content_obj'}->out(); | |||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | 5 | package nes_content; | |||||||||||||||||||||||||||||||||||||||||
| 1242 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1243 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||
| 1245 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1246 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1247 | 3 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 1248 | 3 | my ($container) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||
| 1250 | 3 | $self->{'container'} = $container; | |||||||||||||||||||||||||||||||||||||||||
| 1251 | 3 | $self->{'file_script'} = $self->{'container'}->{'file_script'}; | |||||||||||||||||||||||||||||||||||||||||
| 1252 | 3 | $self->{'out'} = $self->{'container'}->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||
| 1254 | # default content type | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | 3 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1256 | 3 | $self->{'HTTP-status'} = "200 Ok"; | |||||||||||||||||||||||||||||||||||||||||
| 1257 | 3 | $self->{'X-Powered-By'} = "Nes/$VERSION"; | |||||||||||||||||||||||||||||||||||||||||
| 1258 | 3 | $self->{'TAG_HTTP-headers'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||
| 1260 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | ▶ | sub add_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_tags: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | my %tags; | |||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | (%tags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | foreach my $tag ( keys %tags ) { | |||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | $self->{'tags'}{$tag} = $tags{$tag}; | |||||||||||||||||||||||||||||||||||||||||
| 1270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | $self->{'TAG_HTTP-headers'} = $self->{'tags'}{'HTTP-headers'}; | |||||||||||||||||||||||||||||||||||||||||
| 1273 | 0 | $self->{'tags'}{'HTTP-headers'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | 3 | ▶ | sub set_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tags: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1279 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1280 | 3 | my %tags; | |||||||||||||||||||||||||||||||||||||||||
| 1281 | 3 | (%tags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||
| 1283 | 3 | foreach my $tag ( keys %tags ) { | |||||||||||||||||||||||||||||||||||||||||
| 1284 | 2 | $self->{'tags'}{$tag} = $tags{$tag}; | |||||||||||||||||||||||||||||||||||||||||
| 1285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | |||||||||||||||||||||||||||||||||||||||||||
| 1287 | 3 | $self->{'TAG_HTTP-headers'} = $self->{'tags'}{'HTTP-headers'}; | |||||||||||||||||||||||||||||||||||||||||
| 1288 | 3 | $self->{'tags'}{'HTTP-headers'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||
| 1293 | 3 | ▶ | sub interpret { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
interpret: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1294 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1295 | 3 | my %tags; | |||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | 3 | $self->{'interpret'} = nes_interpret->new( $self->{'out'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | $self->{'out'} = $self->{'interpret'}->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | 1 | ▶ | sub get_out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_out: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1304 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||
| 1306 | 1 | return $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | ▶ | sub set_out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_out: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1310 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1311 | 0 | my ($out) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | $self->{'out'} = $out; | |||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||
| 1315 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||
| 1318 | 2 | ▶ | sub go_plugin_first { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_plugin_first: called CC=4 SCAR=17.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1319 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||
| 1321 | 2 | my $self_file = $self->{'container'}->{'file_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 1322 | 2 | my $top_file = $self->{'top_container'}->{'file'}; | |||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||
| 1324 | 2 | ▶ | if ( $self_file eq $top_file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1325 | 2 | foreach my $plugin ( @{$self->{'CFG'}{'auto_load_plugin_top_first'}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | my $interpret = nes_interpret->new( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1327 | 0 | $plugin = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 1328 | 0 | $self->do_script( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||
| 1332 | 2 | foreach my $plugin ( @{$self->{'CFG'}{'auto_load_plugin_all_first'}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | my $interpret = nes_interpret->new( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | $plugin = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | $self->do_script( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||
| 1338 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||
| 1341 | 2 | ▶ | sub go_plugin_last { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_plugin_last: called CC=4 SCAR=17.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1342 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||
| 1344 | 2 | my $self_file = $self->{'container'}->{'file_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 1345 | 2 | my $top_file = $self->{'top_container'}->{'file'}; | |||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||
| 1347 | 2 | ▶ | if ( $self_file eq $top_file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1348 | 2 | foreach my $plugin ( @{$self->{'CFG'}{'auto_load_plugin_top_last'}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1349 | 0 | my $interpret = nes_interpret->new( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1350 | 0 | $plugin = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | $self->do_script( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 2 | foreach my $plugin ( @{$self->{'CFG'}{'auto_load_plugin_all_last'}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | my $interpret = nes_interpret->new( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | $plugin = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | $self->do_script( $plugin ); | |||||||||||||||||||||||||||||||||||||||||
| 1359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||
| 1361 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||
| 1364 | 2 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: called CC=4 SCAR=15.5
| |||||||||||||||||||||||||||||||||||||||||||
| 1365 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | 2 | $self->go_plugin_first(); | |||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||
| 1369 | 2 | foreach my $script ( @{ $self->{'file_script'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 1370 | 2 | ▶ | if ( $script eq 'none' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1371 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | my $nes_obj = Nes::Singleton->new(); | |||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | $nes_obj->out(); | |||||||||||||||||||||||||||||||||||||||||
| 1374 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1377 | 2 | ▶ | if ( $script ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1378 | 2 | $self->do_script( $script ); | |||||||||||||||||||||||||||||||||||||||||
| 1379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||
| 1382 | 2 | $self->go_plugin_last(); | |||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||
| 1384 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||
| 1387 | 2 | ▶ | sub do_script { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_script: called CC=7 SCAR=20.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||
| 1389 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1390 | 2 | my ($script) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||||||||||||||||
| 1392 | 2 | $script = $self->{'top_container'}->get_file_path( $script ); | |||||||||||||||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||||||||||||||||
| 1394 | 2 | my $script_dir = $script; | |||||||||||||||||||||||||||||||||||||||||
| 1395 | 2 | $script_dir =~ s/(.*)(\\|\/).*/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 1396 | 2 | ▶ | push( @INC, $script_dir ) if !$self->{'top_container'}->{'in_inc'}->{$script_dir}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1397 | 2 | $self->{'top_container'}->{'in_inc'}->{$script_dir} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||||||||||||||||
| 1399 | 2 | my $return = do $script; | |||||||||||||||||||||||||||||||||||||||||
| 1400 | 2 | ▶ | unless ($return) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||||||||||||||||
| 1402 | # mod_perl muestra un error cuando se usa exit | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | 2 | ▶ | return if $@ =~ /ModPerl::Util::exit/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||||||||||
| 1405 | 2 | ▶ | warn "couldn't parse $script: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1406 | 2 | ▶ | warn "couldn't do $script: $!" unless defined $return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1407 | 2 | ▶ | warn "couldn't run $script" unless $return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||
| 1410 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||
| 1413 | 2 | ▶ | sub out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
out: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1414 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | 2 | print $self->{'cookies'}->out; | |||||||||||||||||||||||||||||||||||||||||
| 1417 | 2 | print "X-Powered-By: $self->{'X-Powered-By'}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1418 | # print "Status: $self->{'HTTP-status'}\n" if !$self->{'tags'}{'HTTP-headers'}; | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | 2 | ▶ | print $self->{'TAG_HTTP-headers'} || $self->{'Content-type'}."\n\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'TAG_HTTP-headers'} || $self->{'Content-type'} . "\n\n"
MC/DC0%0/1
$self->{'TAG_HTTP-headers'} || $self->{'Content-type'} . "\n\n"
$self->{'TAG_HTTP-headers'}
Truth table50%1/2
A
A= $self->{'TAG_HTTP-headers'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1420 | 2 | print $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | 0 | ▶ | sub location { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1425 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1426 | 0 | my ($location, $status) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1427 | 0 | ▶ | $status = "302 Found" if !$status; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||
| 1429 | 0 | print $self->{'cookies'}->out; | |||||||||||||||||||||||||||||||||||||||||
| 1430 | 0 | print "X-Powered-By: $self->{'X-Powered-By'}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | print "Status: $status\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1432 | 0 | print "Location: $location\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1433 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||
| 1434 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||
| 1438 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||||||||||||||||
| 1440 | 5 | package nes_html; | |||||||||||||||||||||||||||||||||||||||||
| 1441 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1442 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1445 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1446 | 3 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1447 | 3 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||||||||||
| 1449 | 3 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||
| 1451 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||
| 1457 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||
| 1459 | 5 | package nes_nsql; | |||||||||||||||||||||||||||||||||||||||||
| 1460 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1461 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||||||||||||
| 1463 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1464 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1465 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1466 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | # @{ $self->{'file_script'} } = @scripts; | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | 0 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||
| 1471 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||
| 1474 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||
| 1476 | |||||||||||||||||||||||||||||||||||||||||||
| 1477 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||
| 1479 | 5 | package nes_txt; | |||||||||||||||||||||||||||||||||||||||||
| 1480 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1481 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1482 | |||||||||||||||||||||||||||||||||||||||||||
| 1483 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1484 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1485 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1486 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||
| 1488 | # @{ $self->{'file_script'} } = @scripts; | ||||||||||||||||||||||||||||||||||||||||||
| 1489 | 0 | $self->{'Content-type'} = "Content-type: text/plain"; | |||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||||||||||||
| 1494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | 5 | package nes_perl; | |||||||||||||||||||||||||||||||||||||||||
| 1500 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1501 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1504 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1505 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1506 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||
| 1508 | # @{ $self->{'file_script'} } = @scripts; | ||||||||||||||||||||||||||||||||||||||||||
| 1509 | 0 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1512 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||
| 1514 | 0 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1515 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||||||||||
| 1517 | 0 | ▶ | $self->SUPER::go() if @{ $self->{'file_script'} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1518 | |||||||||||||||||||||||||||||||||||||||||||
| 1519 | 0 | require IO::String; | |||||||||||||||||||||||||||||||||||||||||
| 1520 | 0 | my $out; | |||||||||||||||||||||||||||||||||||||||||
| 1521 | 0 | my $str_fh = IO::String->new($out); | |||||||||||||||||||||||||||||||||||||||||
| 1522 | 0 | my $old_fh = select($str_fh); | |||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||
| 1524 | 0 | eval $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||
| 1526 | 0 | ▶ | select($old_fh) if defined $old_fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||
| 1528 | 0 | $self->{'out'} = $out; | |||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||||||||||
| 1532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||||||||||||||||
| 1534 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||||||||||||||||
| 1537 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||
| 1539 | 5 | package nes_shell; | |||||||||||||||||||||||||||||||||||||||||
| 1540 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1541 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||
| 1548 | # @{ $self->{'file_script'} } = @scripts; | ||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||
| 1551 | 0 | return ($self); | |||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||
| 1557 | 0 | ▶ | $self->SUPER::go() if @{ $self->{'file_script'} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | ▶ | if ( $MOD_PERL ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | require IPC::Run; | |||||||||||||||||||||||||||||||||||||||||
| 1562 | # IPC::Open2/Open3 no funcionan con mod_perl | ||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||
| 1564 | 0 | local $| = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | my @command = ( $self->{'CFG'}{'shell_cline'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1566 | 0 | my ( $writer, $reader, $error ); | |||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | my $h = IPC::Run::start (\@command, \$writer, \$reader, \$error, IPC::Run::timeout( 10 )); | |||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | ▶ | $writer = $self->{'out'} || "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'out'} || "\n"
MC/DC0%0/1
$self->{'out'} || "\n"
$self->{'out'}
Truth table0%0/2
A
A= $self->{'out'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | IPC::Run::pump $h; | |||||||||||||||||||||||||||||||||||||||||
| 1570 | 0 | IPC::Run::finish $h; | |||||||||||||||||||||||||||||||||||||||||
| 1571 | 0 | $self->{'out'} = $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||
| 1573 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | |||||||||||||||||||||||||||||||||||||||||||
| 1575 | 0 | require IPC::Open3; | |||||||||||||||||||||||||||||||||||||||||
| 1576 | 0 | my ( $writer, $reader, $error ); | |||||||||||||||||||||||||||||||||||||||||
| 1577 | 0 | my $pid = IPC::Open3::open3( $writer, $reader, $error, "$self->{'CFG'}{'shell_cline'}" ); | |||||||||||||||||||||||||||||||||||||||||
| 1578 | 0 | print $writer $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1579 | 0 | close $writer; | |||||||||||||||||||||||||||||||||||||||||
| 1580 | 0 | $self->{'out'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1581 | 0 | ▶ | while (<$reader>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | $self->{'out'} .= $_; | |||||||||||||||||||||||||||||||||||||||||
| 1583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | close $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1585 | 0 | waitpid( $pid, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||
| 1587 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1590 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||||||||||||||||
| 1592 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||
| 1595 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||
| 1597 | 5 | package nes_php; | |||||||||||||||||||||||||||||||||||||||||
| 1598 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1599 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1600 | |||||||||||||||||||||||||||||||||||||||||||
| 1601 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1602 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1603 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1604 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1605 | |||||||||||||||||||||||||||||||||||||||||||
| 1606 | # @{ $self->{'file_script'} } = @scripts; | ||||||||||||||||||||||||||||||||||||||||||
| 1607 | 0 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | $self->{'is_binary'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1609 | 0 | $self->{'file_name'} = $self->{'container'}->{'file_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | 0 | $self->{'php_wrapper'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1612 | 0 | ▶ | $self->{'php_wrapper'} = 1 if $self->{'file_name'} eq $self->{'top_container'}->{'file'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||
| 1614 | # damos soporte a include PHP al método GET | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | 0 | $self->{'start_script'} = '<?php parse_str($_SERVER[\'QUERY_STRING\'], $_GET); ?>'."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||||||||||||||||
| 1617 | 0 | return ($self); | |||||||||||||||||||||||||||||||||||||||||
| 1618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||||||||||||||||
| 1620 | 0 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: not called CC=19 SCAR=59.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1621 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | ▶ | $self->SUPER::go() if !$self->{'php_wrapper'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | my $cline = $self->{'CFG'}{'php_cline'}; | |||||||||||||||||||||||||||||||||||||||||
| 1626 | 0 | ▶ | $cline = $self->{'CFG'}{'php_cgi_cline'} if $self->{'php_wrapper'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||
| 1628 | 0 | ▶ | if ( $self->{'php_wrapper'} || $MOD_PERL ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"php_wrapper"} or $main::MOD_PERL
MC/DC0%0/2
$self->{"php_wrapper"} or $main::MOD_PERL
$self->{"php_wrapper"}
$main::MOD_PERL
Truth table0%0/3
A or B
A= $self->{"php_wrapper"}B= $main::MOD_PERL
| |||||||||||||||||||||||||||||||||||||||||||
| 1629 | # por seguridad | ||||||||||||||||||||||||||||||||||||||||||
| 1630 | 0 | require Env::C; | |||||||||||||||||||||||||||||||||||||||||
| 1631 | 0 | foreach (keys %ENV) { | |||||||||||||||||||||||||||||||||||||||||
| 1632 | 0 | my $var = $ENV{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 1633 | 0 | utl::no_nes_remove(\$var); | |||||||||||||||||||||||||||||||||||||||||
| 1634 | 0 | Env::C::setenv( $_, $var ); | |||||||||||||||||||||||||||||||||||||||||
| 1635 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||
| 1638 | |||||||||||||||||||||||||||||||||||||||||||
| 1639 | 0 | ▶ | if ( $MOD_PERL ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||||||||||||||||
| 1641 | 0 | local $| = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1642 | 0 | require IPC::Run; | |||||||||||||||||||||||||||||||||||||||||
| 1643 | |||||||||||||||||||||||||||||||||||||||||||
| 1644 | 0 | my @command = split(' ', $cline ); | |||||||||||||||||||||||||||||||||||||||||
| 1645 | 0 | my ( $writer, $reader, $error ); | |||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | my $h = IPC::Run::start (\@command, \$writer, \$reader, \$error, IPC::Run::timeout( 30 )); | |||||||||||||||||||||||||||||||||||||||||
| 1647 | |||||||||||||||||||||||||||||||||||||||||||
| 1648 | 0 | ▶ | if ( $self->{'php_wrapper'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1649 | 0 | ▶ | if ( $ENV{'REQUEST_METHOD'} ne 'GET' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | ▶ | if ( $self->{'query'}->{'save_buffer'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1651 | # todo: es posible que esto consuma mucha memoria en POST grandes | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | # $writer .= $buffer; sin IPC::Run::pump, pero haciendo pump da | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | # errores en mod_perl, comprobar | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | 0 | ▶ | while ( my $buffer = $self->{'query'}->get_buffer ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1655 | 0 | $writer .= $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 1656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1657 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | $writer = $self->{'query'}->get_buffer_raw; | |||||||||||||||||||||||||||||||||||||||||
| 1659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1661 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | # include PHP no soporta el metodo POST, de momento | ||||||||||||||||||||||||||||||||||||||||||
| 1663 | 0 | $writer = $self->{'start_script'}.$self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1664 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1665 | |||||||||||||||||||||||||||||||||||||||||||
| 1666 | 0 | IPC::Run::pump $h; | |||||||||||||||||||||||||||||||||||||||||
| 1667 | 0 | IPC::Run::finish $h; | |||||||||||||||||||||||||||||||||||||||||
| 1668 | 0 | $self->{'out'} = $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1669 | 0 | ▶ | warn $error if $error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | require IPC::Open3; | |||||||||||||||||||||||||||||||||||||||||
| 1674 | 0 | my ( $writer, $reader, $error, $out_error ); | |||||||||||||||||||||||||||||||||||||||||
| 1675 | 0 | my $pid = IPC::Open3::open3( $writer, $reader, $error, $cline ); | |||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | binmode $writer; | |||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | binmode $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1679 | |||||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | ▶ | if ( $self->{'php_wrapper'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1681 | 0 | ▶ | if ( $ENV{'REQUEST_METHOD'} ne 'GET' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1682 | 0 | ▶ | if ( $self->{'query'}->{'save_buffer'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | ▶ | while ( my $buffer = $self->{'query'}->get_buffer ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1684 | 0 | print $writer $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 1685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1687 | 0 | print $writer $self->{'query'}->get_buffer_raw; | |||||||||||||||||||||||||||||||||||||||||
| 1688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1691 | # include PHP no soporta el metodo POST | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | 0 | print $writer $self->{'start_script'}.$self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1693 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | 0 | close $writer; | |||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | $self->{'out'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1698 | 0 | ▶ | while ( read($reader, $buffer, 8190) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1699 | 0 | $self->{'out'} .= $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 1700 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | 0 | close $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1702 | 0 | waitpid( $pid, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 1703 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||
| 1705 | 0 | ▶ | if ( $self->{'php_wrapper'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1706 | 0 | ( $self->{'HTTP-headers'}, $self->{'out'} ) = split(/$CRLF$CRLF/, $self->{'out'},2); | |||||||||||||||||||||||||||||||||||||||||
| 1707 | 0 | $self->{'is_binary'} = $self->{'HTTP-headers'} !~ /Content-Type: text/is; | |||||||||||||||||||||||||||||||||||||||||
| 1708 | 0 | ▶ | $self->SUPER::go() if !$self->{'is_binary'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1709 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | |||||||||||||||||||||||||||||||||||||||||||
| 1711 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | ▶ | sub out { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
out: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||
| 1717 | 0 | binmode STDOUT; | |||||||||||||||||||||||||||||||||||||||||
| 1718 | 0 | print $self->{'cookies'}->out; | |||||||||||||||||||||||||||||||||||||||||
| 1719 | 0 | print "X-Powered-By: $self->{'X-Powered-By'}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1720 | # print "Status: $self->{'HTTP-status'}\n" if !$self->{'tags'}{'HTTP-headers'}; | ||||||||||||||||||||||||||||||||||||||||||
| 1721 | # print $self->{'TAG_HTTP-headers'} || $self->{'Content-type'}."\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | ▶ | print $self->{'HTTP-headers'}."\n\n" if !$self->{'TAG_HTTP-headers'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1723 | 0 | print $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1724 | |||||||||||||||||||||||||||||||||||||||||||
| 1725 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | |||||||||||||||||||||||||||||||||||||||||||
| 1727 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | |||||||||||||||||||||||||||||||||||||||||||
| 1729 | |||||||||||||||||||||||||||||||||||||||||||
| 1730 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||||||||||||||||
| 1732 | 5 | package nes_python; | |||||||||||||||||||||||||||||||||||||||||
| 1733 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1734 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1735 | |||||||||||||||||||||||||||||||||||||||||||
| 1736 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1737 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1738 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1739 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||
| 1741 | # @{ $self->{'file_script'} } = @scripts; | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | 0 | $self->{'Content-type'} = "Content-type: text/html"; | |||||||||||||||||||||||||||||||||||||||||
| 1743 | 0 | $self->{'file_name'} = $self->{'container'}->{'file_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 1744 | # $self->{'file_name'} = $file_name; | ||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||
| 1746 | 0 | return ($self); | |||||||||||||||||||||||||||||||||||||||||
| 1747 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||
| 1749 | 0 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1750 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||||||||||||||||
| 1752 | 0 | ▶ | $self->SUPER::go() if @{ $self->{'file_script'} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1753 | |||||||||||||||||||||||||||||||||||||||||||
| 1754 | 0 | my $cline = $self->{'CFG'}{'python_cline'}; | |||||||||||||||||||||||||||||||||||||||||
| 1755 | 0 | my @command = ( $cline ); | |||||||||||||||||||||||||||||||||||||||||
| 1756 | |||||||||||||||||||||||||||||||||||||||||||
| 1757 | 0 | ▶ | if ( $MOD_PERL ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1758 | |||||||||||||||||||||||||||||||||||||||||||
| 1759 | 0 | require IPC::Run; | |||||||||||||||||||||||||||||||||||||||||
| 1760 | # IPC::Open2/Open3 no funcionan con mod_perl | ||||||||||||||||||||||||||||||||||||||||||
| 1761 | # *** php_cgi no funciona con IPC::Run | ||||||||||||||||||||||||||||||||||||||||||
| 1762 | |||||||||||||||||||||||||||||||||||||||||||
| 1763 | 0 | local $| = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | my ( $writer, $reader, $error ); | |||||||||||||||||||||||||||||||||||||||||
| 1765 | 0 | my $h = IPC::Run::start (\@command, \$writer, \$reader, \$error, IPC::Run::timeout( 10 )); | |||||||||||||||||||||||||||||||||||||||||
| 1766 | 0 | ▶ | $writer = $self->{'out'} || "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'out'} || "\n"
MC/DC0%0/1
$self->{'out'} || "\n"
$self->{'out'}
Truth table0%0/2
A
A= $self->{'out'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1767 | 0 | IPC::Run::pump $h; | |||||||||||||||||||||||||||||||||||||||||
| 1768 | 0 | IPC::Run::finish $h; | |||||||||||||||||||||||||||||||||||||||||
| 1769 | 0 | $self->{'out'} = $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1770 | |||||||||||||||||||||||||||||||||||||||||||
| 1771 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||
| 1773 | 0 | require IPC::Open2; | |||||||||||||||||||||||||||||||||||||||||
| 1774 | 0 | my ( $reader, $writer ); | |||||||||||||||||||||||||||||||||||||||||
| 1775 | 0 | my $pid = IPC::Open2::open2( $reader, $writer, "@command" ); | |||||||||||||||||||||||||||||||||||||||||
| 1776 | 0 | print $writer $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 1777 | 0 | close $writer; | |||||||||||||||||||||||||||||||||||||||||
| 1778 | 0 | $self->{'out'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1779 | 0 | ▶ | while (<$reader>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1780 | 0 | $self->{'out'} .= $_; | |||||||||||||||||||||||||||||||||||||||||
| 1781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1782 | 0 | close $reader; | |||||||||||||||||||||||||||||||||||||||||
| 1783 | 0 | waitpid( $pid, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||
| 1785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | |||||||||||||||||||||||||||||||||||||||||||
| 1787 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1788 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | |||||||||||||||||||||||||||||||||||||||||||
| 1790 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||
| 1792 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||
| 1794 | 5 | package nes_js; | |||||||||||||||||||||||||||||||||||||||||
| 1795 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1796 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1797 | |||||||||||||||||||||||||||||||||||||||||||
| 1798 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1799 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1800 | 0 | my ( $container ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1801 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1802 | |||||||||||||||||||||||||||||||||||||||||||
| 1803 | 0 | $self->{'Content-type'} = "Content-type: text/javascript"; | |||||||||||||||||||||||||||||||||||||||||
| 1804 | |||||||||||||||||||||||||||||||||||||||||||
| 1805 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1806 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||||||||||||||||
| 1808 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||
| 1810 | # lo intenta como si fuese un archivo de texto plano | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||
| 1813 | 5 | package nes_unknown; | |||||||||||||||||||||||||||||||||||||||||
| 1814 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1815 | 5 | @ISA = qw( nes_content ); | |||||||||||||||||||||||||||||||||||||||||
| 1816 | |||||||||||||||||||||||||||||||||||||||||||
| 1817 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1818 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1819 | 0 | my ($container) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1820 | 0 | my $self = $class->SUPER::new($container); | |||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||
| 1822 | 0 | $self->{'Content-type'} = "Content-type: text/plain"; | |||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | 0 | return ($self); | |||||||||||||||||||||||||||||||||||||||||
| 1825 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||
| 1827 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1828 | |||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||
| 1830 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||
| 1832 | 5 | package nes_interpret; | |||||||||||||||||||||||||||||||||||||||||
| 1833 | 5 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1834 | 5 | @ISA = qw( Nes ); | |||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||
| 1836 | 7 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1837 | 7 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1838 | 7 | my ($out) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1839 | 7 | my $self = $class->SUPER::new(); | |||||||||||||||||||||||||||||||||||||||||
| 1840 | |||||||||||||||||||||||||||||||||||||||||||
| 1841 | 7 | $self->{'tag_start'} = '{:'; | |||||||||||||||||||||||||||||||||||||||||
| 1842 | 7 | $self->{'tag_end'} = ':}'; | |||||||||||||||||||||||||||||||||||||||||
| 1843 | 7 | $self->{'pre_start'} = '〈'; | |||||||||||||||||||||||||||||||||||||||||
| 1844 | 7 | $self->{'pre_end'} = '〉'; | |||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||
| 1846 | 7 | $self->{'tag_nes'} = 'NES'; | |||||||||||||||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||||||||||||||||
| 1848 | 7 | $self->{'tag_var'} = '\$'; | |||||||||||||||||||||||||||||||||||||||||
| 1849 | 7 | $self->{'tag_env'} = '\*'; | |||||||||||||||||||||||||||||||||||||||||
| 1850 | 7 | $self->{'tag_expre'} = '\~'; | |||||||||||||||||||||||||||||||||||||||||
| 1851 | 7 | $self->{'tag_tpl'} = '\@'; | |||||||||||||||||||||||||||||||||||||||||
| 1852 | 7 | $self->{'tag_sql'} = 'sql'; | |||||||||||||||||||||||||||||||||||||||||
| 1853 | 7 | $self->{'tag_hash'} = '\%'; | |||||||||||||||||||||||||||||||||||||||||
| 1854 | 7 | $self->{'tag_field'} = '\@\$'; | |||||||||||||||||||||||||||||||||||||||||
| 1855 | 7 | $self->{'tag_include'} = 'include'; | |||||||||||||||||||||||||||||||||||||||||
| 1856 | 7 | $self->{'tag_comment'} = '\#'; | |||||||||||||||||||||||||||||||||||||||||
| 1857 | 7 | $self->{'tag_plugin'} = '\&'; | |||||||||||||||||||||||||||||||||||||||||
| 1858 | |||||||||||||||||||||||||||||||||||||||||||
| 1859 | 7 | $self->{'pre_subs_start'} = ':⟩:'; | |||||||||||||||||||||||||||||||||||||||||
| 1860 | 7 | $self->{'pre_subs_end'} = ':◊:'; | |||||||||||||||||||||||||||||||||||||||||
| 1861 | |||||||||||||||||||||||||||||||||||||||||||
| 1862 | 7 | $self->{'out'} = $out; | |||||||||||||||||||||||||||||||||||||||||
| 1863 | 7 | ▶ | $self->preformat() if $out; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1864 | |||||||||||||||||||||||||||||||||||||||||||
| 1865 | # banderas para eliminar de las variables código malicioso | ||||||||||||||||||||||||||||||||||||||||||
| 1866 | 3 | $self->{'security_options'}{'no_sql'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1867 | 3 | $self->{'security_options'}{'no_html'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1868 | 3 | $self->{'security_options'}{'no_br'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1869 | 3 | $self->{'security_options'}{'no_nes'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||
| 1871 | 3 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 1872 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||
| 1874 | 4 | ▶ | sub preformat { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preformat: called CC=1 SCAR=1.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1875 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||
| 1877 | 4 | my $reg_block; | |||||||||||||||||||||||||||||||||||||||||
| 1878 | my $reg_param; | ||||||||||||||||||||||||||||||||||||||||||
| 1879 | 4 | my $reg_tag; | |||||||||||||||||||||||||||||||||||||||||
| 1880 | 4 | my $all_tag; | |||||||||||||||||||||||||||||||||||||||||
| 1881 | 4 | my $reg_tag_plugin; | |||||||||||||||||||||||||||||||||||||||||
| 1882 | 4 | my $param_bracket; | |||||||||||||||||||||||||||||||||||||||||
| 1883 | 4 | my $comment; | |||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||
| 1885 | 5 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1886 | 5 | ▶ | use re 'eval'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1887 | $reg_block = qr/ | ||||||||||||||||||||||||||||||||||||||||||
| 1888 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1889 | $self->{'pre_start'} | ||||||||||||||||||||||||||||||||||||||||||
| 1890 | (?> | ||||||||||||||||||||||||||||||||||||||||||
| 1891 | (?> [^$self->{'pre_start'}$self->{'pre_end'}]+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 1892 | | | ||||||||||||||||||||||||||||||||||||||||||
| 1893 | (??{$reg_block}) | ||||||||||||||||||||||||||||||||||||||||||
| 1894 | )* | ||||||||||||||||||||||||||||||||||||||||||
| 1895 | $self->{'pre_end'} | ||||||||||||||||||||||||||||||||||||||||||
| 1896 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1897 | ( ?) | ||||||||||||||||||||||||||||||||||||||||||
| 1898 | 4 | /ix; | |||||||||||||||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||||||||||||||||
| 1900 | $param_bracket = qr/ | ||||||||||||||||||||||||||||||||||||||||||
| 1901 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1902 | \( # parametros con paréntesis | ||||||||||||||||||||||||||||||||||||||||||
| 1903 | (?> | ||||||||||||||||||||||||||||||||||||||||||
| 1904 | (?> [^\(\)]+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 1905 | | | ||||||||||||||||||||||||||||||||||||||||||
| 1906 | (??{$param_bracket}) | ||||||||||||||||||||||||||||||||||||||||||
| 1907 | )* | ||||||||||||||||||||||||||||||||||||||||||
| 1908 | \) | ||||||||||||||||||||||||||||||||||||||||||
| 1909 | | | ||||||||||||||||||||||||||||||||||||||||||
| 1910 | [^\(\)]\S* # o sin paréntesis | ||||||||||||||||||||||||||||||||||||||||||
| 1911 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1912 | 0 | /ix; | |||||||||||||||||||||||||||||||||||||||||
| 1913 | |||||||||||||||||||||||||||||||||||||||||||
| 1914 | 0 | $reg_tag = qr/ | |||||||||||||||||||||||||||||||||||||||||
| 1915 | ^\s*$self->{'pre_start'}\s* | ||||||||||||||||||||||||||||||||||||||||||
| 1916 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1917 | $self->{'tag_var'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1918 | $self->{'tag_env'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1919 | $self->{'tag_expre'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1920 | $self->{'tag_tpl'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1921 | $self->{'tag_sql'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1922 | $self->{'tag_field'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1923 | $self->{'tag_hash'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1924 | $self->{'tag_plugin'} | | ||||||||||||||||||||||||||||||||||||||||||
| 1925 | $self->{'tag_include'} | ||||||||||||||||||||||||||||||||||||||||||
| 1926 | )\s* | ||||||||||||||||||||||||||||||||||||||||||
| 1927 | $param_bracket | ||||||||||||||||||||||||||||||||||||||||||
| 1928 | (.*) | ||||||||||||||||||||||||||||||||||||||||||
| 1929 | \s*$self->{'pre_end'}\s*$ | ||||||||||||||||||||||||||||||||||||||||||
| 1930 | /isx; | ||||||||||||||||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||||||||||||||||
| 1932 | 0 | $reg_tag_plugin = qr{(?six) | |||||||||||||||||||||||||||||||||||||||||
| 1933 | ^\s*$self->{'pre_start'}\s* | ||||||||||||||||||||||||||||||||||||||||||
| 1934 | $self->{'tag_plugin'} | ||||||||||||||||||||||||||||||||||||||||||
| 1935 | \s* | ||||||||||||||||||||||||||||||||||||||||||
| 1936 | (\S+) # tag del plugin | ||||||||||||||||||||||||||||||||||||||||||
| 1937 | \s* | ||||||||||||||||||||||||||||||||||||||||||
| 1938 | $param_bracket # parametros | ||||||||||||||||||||||||||||||||||||||||||
| 1939 | (.*) # code | ||||||||||||||||||||||||||||||||||||||||||
| 1940 | $self->{'pre_end'}\s*$ | ||||||||||||||||||||||||||||||||||||||||||
| 1941 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1942 | |||||||||||||||||||||||||||||||||||||||||||
| 1943 | $comment = qr/ | ||||||||||||||||||||||||||||||||||||||||||
| 1944 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1945 | $self->{'pre_start'}\s*$self->{'tag_comment'} | ||||||||||||||||||||||||||||||||||||||||||
| 1946 | (?> | ||||||||||||||||||||||||||||||||||||||||||
| 1947 | (?> [^$self->{'pre_start'}$self->{'pre_end'}]+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 1948 | | | ||||||||||||||||||||||||||||||||||||||||||
| 1949 | (??{$reg_block}) | ||||||||||||||||||||||||||||||||||||||||||
| 1950 | )* | ||||||||||||||||||||||||||||||||||||||||||
| 1951 | $self->{'pre_end'} | ||||||||||||||||||||||||||||||||||||||||||
| 1952 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1953 | ( ?)(\s*) | ||||||||||||||||||||||||||||||||||||||||||
| 1954 | 0 | /ix; | |||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||
| 1956 | 0 | $self->{'blocks'} = $reg_block; | |||||||||||||||||||||||||||||||||||||||||
| 1957 | 0 | $self->{'block_tag'} = $reg_tag; | |||||||||||||||||||||||||||||||||||||||||
| 1958 | 0 | $self->{'block_plugin'} = $reg_tag_plugin; | |||||||||||||||||||||||||||||||||||||||||
| 1959 | 0 | $self->{'param_bracket'} = $param_bracket; | |||||||||||||||||||||||||||||||||||||||||
| 1960 | 0 | $self->{'block_comment'} = $comment; | |||||||||||||||||||||||||||||||||||||||||
| 1961 | |||||||||||||||||||||||||||||||||||||||||||
| 1962 | 0 | $self->{'out'} =~ s/$self->{'pre_start'}/$self->{'pre_subs_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1963 | 0 | $self->{'out'} =~ s/$self->{'pre_end'}/$self->{'pre_subs_end'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1964 | |||||||||||||||||||||||||||||||||||||||||||
| 1965 | 0 | $self->{'out'} =~ s/$self->{'tag_start'}/$self->{'pre_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1966 | 0 | $self->{'out'} =~ s/$self->{'tag_end'}/$self->{'pre_end'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||||||||||||||||
| 1968 | # elimina los comentarios, eliminándolos aquí ahorramos CPU | ||||||||||||||||||||||||||||||||||||||||||
| 1969 | 0 | $self->{'out'} =~ s/$self->{'block_comment'}//g; | |||||||||||||||||||||||||||||||||||||||||
| 1970 | |||||||||||||||||||||||||||||||||||||||||||
| 1971 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1972 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1973 | |||||||||||||||||||||||||||||||||||||||||||
| 1974 | 0 | ▶ | sub clear_tags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_tags: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1975 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1976 | |||||||||||||||||||||||||||||||||||||||||||
| 1977 | 0 | $self->{'out'} =~ s/$self->{'blocks'}//g; | |||||||||||||||||||||||||||||||||||||||||
| 1978 | |||||||||||||||||||||||||||||||||||||||||||
| 1979 | # $self->{'out'} =~ s/$self->{'pre_start'}/$self->{'tag_start'}/g; | ||||||||||||||||||||||||||||||||||||||||||
| 1980 | # $self->{'out'} =~ s/$self->{'pre_end'}/$self->{'tag_end'}/g; | ||||||||||||||||||||||||||||||||||||||||||
| 1981 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1982 | # $self->{'out'} =~ s/$self->{'pre_subs_start'}/$self->{'pre_start'}/g; | ||||||||||||||||||||||||||||||||||||||||||
| 1983 | # $self->{'out'} =~ s/$self->{'pre_subs_end'}/$self->{'pre_end'}/g; | ||||||||||||||||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||||||||||||||||
| 1985 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1986 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1987 | |||||||||||||||||||||||||||||||||||||||||||
| 1988 | 0 | ▶ | sub postformat { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postformat: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1989 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1990 | 0 | my ($out) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1991 | |||||||||||||||||||||||||||||||||||||||||||
| 1992 | 0 | $out =~ s/$self->{'pre_start'}/$self->{'tag_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1993 | 0 | $out =~ s/$self->{'pre_end'}/$self->{'tag_end'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1994 | |||||||||||||||||||||||||||||||||||||||||||
| 1995 | 0 | $out =~ s/$self->{'pre_subs_start'}/$self->{'pre_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1996 | 0 | $out =~ s/$self->{'pre_subs_end'}/$self->{'pre_end'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1997 | |||||||||||||||||||||||||||||||||||||||||||
| 1998 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 1999 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||
| 2001 | 0 | ▶ | sub postformat2 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postformat2: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2002 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2003 | |||||||||||||||||||||||||||||||||||||||||||
| 2004 | 0 | $self->{'out'} =~ s/$self->{'pre_start'}/$self->{'tag_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 2005 | 0 | $self->{'out'} =~ s/$self->{'pre_end'}/$self->{'tag_end'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 2006 | |||||||||||||||||||||||||||||||||||||||||||
| 2007 | 0 | $self->{'out'} =~ s/$self->{'pre_subs_start'}/$self->{'pre_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 2008 | 0 | $self->{'out'} =~ s/$self->{'pre_subs_end'}/$self->{'pre_end'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||
| 2010 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 2011 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2012 | |||||||||||||||||||||||||||||||||||||||||||
| 2013 | 0 | ▶ | sub go { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2014 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2015 | 0 | my (%tags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2016 | |||||||||||||||||||||||||||||||||||||||||||
| 2017 | 0 | foreach my $tag ( keys %tags ) { | |||||||||||||||||||||||||||||||||||||||||
| 2018 | 0 | $self->{'tags'}{$tag} = $tags{$tag}; | |||||||||||||||||||||||||||||||||||||||||
| 2019 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2020 | |||||||||||||||||||||||||||||||||||||||||||
| 2021 | 0 | ▶ | while ( $self->{'out'} =~ s/$self->{'blocks'}/$self->replace_block($1,($2 || ''),($3 || ''))/e ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$2 || ''
$3 || ''
MC/DC0%0/1
$2 || ''
$2
MC/DC0%0/1
$3 || ''
$3
Truth table0%0/2
A
A= $2
Truth table0%0/2
A
A= $3
| |||||||||||||||||||||||||||||||||||||||||||
| 2022 | |||||||||||||||||||||||||||||||||||||||||||
| 2023 | # con los "$space" se "intenta" dejar el HTML como estaba sin huecos | ||||||||||||||||||||||||||||||||||||||||||
| 2024 | # $self->replace_block($1).$2.$3.$4 No funciona, $1... pierden su valor | ||||||||||||||||||||||||||||||||||||||||||
| 2025 | # cuando vuelven de la función | ||||||||||||||||||||||||||||||||||||||||||
| 2026 | # $2.$3.$4$self->replace_block($1) Sí funcionaría, curiosamente? | ||||||||||||||||||||||||||||||||||||||||||
| 2027 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2028 | |||||||||||||||||||||||||||||||||||||||||||
| 2029 | 0 | $self->postformat2; | |||||||||||||||||||||||||||||||||||||||||
| 2030 | 0 | return $self->{'out'}; | |||||||||||||||||||||||||||||||||||||||||
| 2031 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||
| 2033 | 3 | ▶ | sub param_block { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
param_block: called CC=8 SCAR=23.4
| |||||||||||||||||||||||||||||||||||||||||||
| 2034 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2035 | 3 | my ($params,$skip_inclusion) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||||||||||||||||
| 2037 | 3 | ▶ | return if !$params; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||||||||||||||||
| 2039 | # los parámetros pueden tener estos formatos: | ||||||||||||||||||||||||||||||||||||||||||
| 2040 | # parámetro: | ||||||||||||||||||||||||||||||||||||||||||
| 2041 | # sin paréntesis, sin comomillas, sin espacios, un sólo parámetro | ||||||||||||||||||||||||||||||||||||||||||
| 2042 | # (parámetro,parámetro): | ||||||||||||||||||||||||||||||||||||||||||
| 2043 | # con paréntesis, sin espacios, con o sin comillas, uno o más parámetros | ||||||||||||||||||||||||||||||||||||||||||
| 2044 | # separados por comas | ||||||||||||||||||||||||||||||||||||||||||
| 2045 | # ('parámetro uno','parámetro,dos'): | ||||||||||||||||||||||||||||||||||||||||||
| 2046 | # comillas necesarias cuando hay espacios o comas en los parámetros. | ||||||||||||||||||||||||||||||||||||||||||
| 2047 | # ('parámetro \'uno'): | ||||||||||||||||||||||||||||||||||||||||||
| 2048 | # las comillas requieren barra invertida | ||||||||||||||||||||||||||||||||||||||||||
| 2049 | # las comillas dobles no se utilizan, se reservan para su uso en futuras | ||||||||||||||||||||||||||||||||||||||||||
| 2050 | # versiones, requieren barra invertida. | ||||||||||||||||||||||||||||||||||||||||||
| 2051 | |||||||||||||||||||||||||||||||||||||||||||
| 2052 | # 1.02.2 soporte para dobles comillas en parámetros: | ||||||||||||||||||||||||||||||||||||||||||
| 2053 | # ("parámetro \"uno\"", "parámetro 'dos'"): | ||||||||||||||||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||||||||||||||||
| 2055 | 3 | $params =~ s/^\s*\(//; | |||||||||||||||||||||||||||||||||||||||||
| 2056 | 3 | $params =~ s/\)\s*$//; | |||||||||||||||||||||||||||||||||||||||||
| 2057 | 3 | my @param; | |||||||||||||||||||||||||||||||||||||||||
| 2058 | 3 | my $this = ''; | |||||||||||||||||||||||||||||||||||||||||
| 2059 | 3 | ▶ | while ( $params =~ s/\s*"([^\"\\]*(?:\\.[^\"\\]*)*)"\s*,?|\s*'([^\'\\]*(?:\\.[^\'\\]*)*)'\s*,?|\s*([^,\s]+)\s*,?|\s*,// ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2060 | 3 | $this = $+; | |||||||||||||||||||||||||||||||||||||||||
| 2061 | 3 | ▶ | $this =~ s/\\'/'/g if $this; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2062 | 3 | ▶ | $this =~ s/\\"/"/g if $this; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2063 | |||||||||||||||||||||||||||||||||||||||||||
| 2064 | 3 | ▶ | if ( !$skip_inclusion ) { # Permite la inclusión en los parámetros | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2065 | 3 | ▶ | if ($this =~ /$self->{'pre_start'}/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2066 | 0 | my $interpret = nes_interpret->new( $self->postformat($this) ); | |||||||||||||||||||||||||||||||||||||||||
| 2067 | 0 | $this = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 2068 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2069 | 3 | ▶ | if ($this =~ /$self->{'tag_start'}/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2070 | 0 | my $interpret = nes_interpret->new( $this ); | |||||||||||||||||||||||||||||||||||||||||
| 2071 | 0 | $this = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 2072 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2073 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2074 | |||||||||||||||||||||||||||||||||||||||||||
| 2075 | 3 | push @param, $this; | |||||||||||||||||||||||||||||||||||||||||
| 2076 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2077 | |||||||||||||||||||||||||||||||||||||||||||
| 2078 | 3 | return @param; | |||||||||||||||||||||||||||||||||||||||||
| 2079 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2080 | |||||||||||||||||||||||||||||||||||||||||||
| 2081 | 0 | ▶ | sub replace_block { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_block: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2082 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2083 | 0 | my ( $block, $space1, $space2 ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2084 | 0 | my ( $tag, $params, $code ) = $block =~ /$self->{'block_tag'}/; | |||||||||||||||||||||||||||||||||||||||||
| 2085 | 0 | my $out; | |||||||||||||||||||||||||||||||||||||||||
| 2086 | |||||||||||||||||||||||||||||||||||||||||||
| 2087 | 0 | ▶ | if ( $tag =~ /^$self->{'tag_expre'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 2088 | |||||||||||||||||||||||||||||||||||||||||||
| 2089 | 0 | $out = $self->replace_expre( $code, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 2090 | |||||||||||||||||||||||||||||||||||||||||||
| 2091 | } elsif ( $tag =~ /^$self->{'tag_tpl'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2092 | |||||||||||||||||||||||||||||||||||||||||||
| 2093 | 0 | $out = $self->replace_tpl( $code, $self->param_block($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 2094 | |||||||||||||||||||||||||||||||||||||||||||
| 2095 | } elsif ( $tag =~ /^$self->{'tag_sql'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2096 | |||||||||||||||||||||||||||||||||||||||||||
| 2097 | 0 | $out = $self->replace_nsql( $code, $self->param_block($params,1) ); | |||||||||||||||||||||||||||||||||||||||||
| 2098 | |||||||||||||||||||||||||||||||||||||||||||
| 2099 | } elsif ( $tag =~ /^$self->{'tag_hash'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2100 | |||||||||||||||||||||||||||||||||||||||||||
| 2101 | 0 | $out = $self->replace_hash( $code, $self->param_block($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 2102 | |||||||||||||||||||||||||||||||||||||||||||
| 2103 | } elsif ( $tag =~ /^$self->{'tag_include'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2104 | |||||||||||||||||||||||||||||||||||||||||||
| 2105 | 0 | $out = $self->replace_ind( $self->param_block($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 2106 | |||||||||||||||||||||||||||||||||||||||||||
| 2107 | } elsif ( $tag =~ /^$self->{'tag_var'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2108 | |||||||||||||||||||||||||||||||||||||||||||
| 2109 | 0 | $out = $self->replace_var( $self->param_block($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 2110 | |||||||||||||||||||||||||||||||||||||||||||
| 2111 | } elsif ( $tag =~ /^$self->{'tag_env'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2112 | |||||||||||||||||||||||||||||||||||||||||||
| 2113 | 0 | $out = $self->replace_env( $self->param_block($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 2114 | |||||||||||||||||||||||||||||||||||||||||||
| 2115 | } elsif ( $tag =~ /^$self->{'tag_plugin'}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 2116 | |||||||||||||||||||||||||||||||||||||||||||
| 2117 | 0 | $out = $self->replace_plugin( $block, $space1, $space2 ); | |||||||||||||||||||||||||||||||||||||||||
| 2118 | |||||||||||||||||||||||||||||||||||||||||||
| 2119 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 2120 | |||||||||||||||||||||||||||||||||||||||||||
| 2121 | # si no conoce el tag lo deja como estaba | ||||||||||||||||||||||||||||||||||||||||||
| 2122 | 0 | $block =~ s/(^\s*)($self->{'pre_start'})/$1$self->{'tag_start'}/g; | |||||||||||||||||||||||||||||||||||||||||
| 2123 | 0 | $block =~ s/($self->{'pre_end'})(\s*$)/$self->{'tag_end'}$2/g; | |||||||||||||||||||||||||||||||||||||||||
| 2124 | |||||||||||||||||||||||||||||||||||||||||||
| 2125 | 0 | return $block; | |||||||||||||||||||||||||||||||||||||||||
| 2126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2127 | |||||||||||||||||||||||||||||||||||||||||||
| 2128 | 0 | $out .= $space1; | |||||||||||||||||||||||||||||||||||||||||
| 2129 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 2130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2131 | |||||||||||||||||||||||||||||||||||||||||||
| 2132 | 0 | ▶ | sub security { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
security: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2133 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2134 | 0 | my ($value, @security_options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2135 | |||||||||||||||||||||||||||||||||||||||||||
| 2136 | 0 | ▶ | return $value if $value =~ /^\d*$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2137 | |||||||||||||||||||||||||||||||||||||||||||
| 2138 | 0 | my $tmp_no_html = $self->{'security_options'}{'no_html'}; | |||||||||||||||||||||||||||||||||||||||||
| 2139 | 0 | my $tmp_no_nes = $self->{'security_options'}{'no_nes'}; | |||||||||||||||||||||||||||||||||||||||||
| 2140 | 0 | my $tmp_no_br = $self->{'security_options'}{'no_br'}; | |||||||||||||||||||||||||||||||||||||||||
| 2141 | 0 | my $tmp_no_sql = $self->{'security_options'}{'no_sql'}; | |||||||||||||||||||||||||||||||||||||||||
| 2142 | |||||||||||||||||||||||||||||||||||||||||||
| 2143 | 0 | my @yes_tag; | |||||||||||||||||||||||||||||||||||||||||
| 2144 | 0 | foreach my $key ( @security_options ) { | |||||||||||||||||||||||||||||||||||||||||
| 2145 | 0 | my $val = 1; | |||||||||||||||||||||||||||||||||||||||||
| 2146 | 0 | ▶ | if ($key =~ /^yes_tag_(.*)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2147 | 0 | push(@yes_tag, $1); | |||||||||||||||||||||||||||||||||||||||||
| 2148 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 2149 | 0 | ▶ | $val = 0 if $key =~ /^yes_/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2150 | 0 | $key =~ s/^yes_/no_/; | |||||||||||||||||||||||||||||||||||||||||
| 2151 | 0 | $self->{'security_options'}{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 2152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2154 | 0 | ▶ | push(@yes_tag, 'br') if !$self->{'security_options'}{'no_br'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2155 | |||||||||||||||||||||||||||||||||||||||||||
| 2156 | 0 | ▶ | $value = utl::quote($value) if $self->{'security_options'}{'no_sql'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2157 | 0 | ▶ | $value = utl::no_nes($value) if $self->{'security_options'}{'no_nes'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2158 | 0 | ▶ | $value = utl::no_html( $value, @yes_tag ) if $self->{'security_options'}{'no_html'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2159 | |||||||||||||||||||||||||||||||||||||||||||
| 2160 | 0 | $self->{'security_options'}{'no_html'} = $tmp_no_html; | |||||||||||||||||||||||||||||||||||||||||
| 2161 | 0 | $self->{'security_options'}{'no_nes'} = $tmp_no_nes; | |||||||||||||||||||||||||||||||||||||||||
| 2162 | 0 | $self->{'security_options'}{'no_br'} = $tmp_no_br; | |||||||||||||||||||||||||||||||||||||||||
| 2163 | 0 | $self->{'security_options'}{'no_sql'} = $tmp_no_sql; | |||||||||||||||||||||||||||||||||||||||||
| 2164 | |||||||||||||||||||||||||||||||||||||||||||
| 2165 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 2166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2167 | |||||||||||||||||||||||||||||||||||||||||||
| 2168 | 3 | ▶ | sub replace_NES { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_NES: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2169 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2170 | 3 | my ($block) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2171 | |||||||||||||||||||||||||||||||||||||||||||
| 2172 | 3 | ▶ | return if !$block =~ /$self->{'tag_start'}\s*$self->{'tag_nes'}/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2173 | |||||||||||||||||||||||||||||||||||||||||||
| 2174 | 3 | my $tagnes = qr{(?ix) | |||||||||||||||||||||||||||||||||||||||||
| 2175 | $self->{'tag_start'}\s*$self->{'tag_nes'} | ||||||||||||||||||||||||||||||||||||||||||
| 2176 | \s*([^\s]*)\s* # vesión | ||||||||||||||||||||||||||||||||||||||||||
| 2177 | (.*) # parametros | ||||||||||||||||||||||||||||||||||||||||||
| 2178 | \s* | ||||||||||||||||||||||||||||||||||||||||||
| 2179 | $self->{'tag_end'} | ||||||||||||||||||||||||||||||||||||||||||
| 2180 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 2181 | |||||||||||||||||||||||||||||||||||||||||||
| 2182 | 3 | my ( $version, $params ) = $block =~ /$tagnes/; | |||||||||||||||||||||||||||||||||||||||||
| 2183 | 3 | my @param = $self->param_block($params); | |||||||||||||||||||||||||||||||||||||||||
| 2184 | |||||||||||||||||||||||||||||||||||||||||||
| 2185 | 3 | unshift( @param, $version ); | |||||||||||||||||||||||||||||||||||||||||
| 2186 | |||||||||||||||||||||||||||||||||||||||||||
| 2187 | 3 | return @param; | |||||||||||||||||||||||||||||||||||||||||
| 2188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2189 | |||||||||||||||||||||||||||||||||||||||||||
| 2190 | 0 | ▶ | sub replace_var { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_var: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2191 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2192 | 0 | my ($var, @security_options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2193 | |||||||||||||||||||||||||||||||||||||||||||
| 2194 | 0 | return $self->security( $self->{'tags'}{$var}, @security_options ); | |||||||||||||||||||||||||||||||||||||||||
| 2195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2196 | |||||||||||||||||||||||||||||||||||||||||||
| 2197 | 0 | ▶ | sub replace_expre { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_expre: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 2198 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2199 | 0 | my ( $code, $expre ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||||||||||||||||
| 2201 | 0 | $expre =~ s/\$/:-:var:-:/g; | |||||||||||||||||||||||||||||||||||||||||
| 2202 | 0 | $expre =~ s/\*/:-:env:-:/g; | |||||||||||||||||||||||||||||||||||||||||
| 2203 | |||||||||||||||||||||||||||||||||||||||||||
| 2204 | 0 | my $nodef = undef; | |||||||||||||||||||||||||||||||||||||||||
| 2205 | 0 | my %vars; | |||||||||||||||||||||||||||||||||||||||||
| 2206 | 0 | my $reg = qr{(?x) ((:-:var:-:|:-:env:-:)\s*(\w*)) }; | |||||||||||||||||||||||||||||||||||||||||
| 2207 | |||||||||||||||||||||||||||||||||||||||||||
| 2208 | 0 | ▶ | while ( $expre =~ /$reg/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2209 | 0 | my $tvar = $1; | |||||||||||||||||||||||||||||||||||||||||
| 2210 | 0 | my $tag = $2; | |||||||||||||||||||||||||||||||||||||||||
| 2211 | 0 | my $var = $3; | |||||||||||||||||||||||||||||||||||||||||
| 2212 | 0 | ▶ | if ( $tag =~ /^:-:var:-:$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2213 | |||||||||||||||||||||||||||||||||||||||||||
| 2214 | 0 | ▶ | if ( defined $self->{'tags'}{$var} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2215 | 0 | $vars{$var} = $self->{'tags'}{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 2216 | 0 | $expre =~ s/$reg/\$vars\{\'$var\'\}/; | |||||||||||||||||||||||||||||||||||||||||
| 2217 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 2218 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 2219 | 0 | $expre =~ s/$reg/\$nodef/; | |||||||||||||||||||||||||||||||||||||||||
| 2220 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 2221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2222 | |||||||||||||||||||||||||||||||||||||||||||
| 2223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2224 | 0 | ▶ | if ( $tag =~ /^:-:env:-:$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2225 | |||||||||||||||||||||||||||||||||||||||||||
| 2226 | 0 | ▶ | if ( defined $self->{'top_container'}->{'nes_env'}{$var} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2227 | 0 | $vars{$var} = $self->{'top_container'}->{'nes_env'}{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 2228 | 0 | $expre =~ s/$reg/\$vars\{\'$var\'\}/; | |||||||||||||||||||||||||||||||||||||||||
| 2229 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 2230 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 2231 | 0 | $expre =~ s/$reg/\$nodef/; | |||||||||||||||||||||||||||||||||||||||||
| 2232 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 2233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2234 | |||||||||||||||||||||||||||||||||||||||||||
| 2235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2237 | |||||||||||||||||||||||||||||||||||||||||||
| 2238 | 0 | ▶ | return $code if ( eval $expre ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2239 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 2240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2241 | |||||||||||||||||||||||||||||||||||||||||||
| 2242 | 0 | ▶ | sub replace_ind { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_ind: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2243 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2244 | 0 | my (@param) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2245 | |||||||||||||||||||||||||||||||||||||||||||
| 2246 | 0 | my $file = shift @param; | |||||||||||||||||||||||||||||||||||||||||
| 2247 | |||||||||||||||||||||||||||||||||||||||||||
| 2248 | 0 | my $obj_name = $file; | |||||||||||||||||||||||||||||||||||||||||
| 2249 | 0 | $obj_name =~ s/.*\///; | |||||||||||||||||||||||||||||||||||||||||
| 2250 | 0 | $obj_name =~ s/\.[^\.]*$//; | |||||||||||||||||||||||||||||||||||||||||
| 2251 | |||||||||||||||||||||||||||||||||||||||||||
| 2252 | 0 | ▶ | unless ( $file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2253 | 0 | warn "Void include in $self->{'container'}->{'file_name'}"; | |||||||||||||||||||||||||||||||||||||||||
| 2254 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 2255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2256 | |||||||||||||||||||||||||||||||||||||||||||
| 2257 | 0 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 2258 | 0 | $self->{'top_container'}->set_nes_env( 'q_obj_param_' . $count, $obj_name ); | |||||||||||||||||||||||||||||||||||||||||
| 2259 | 0 | $self->{'query'}->set( 'obj_param_' . $count, $obj_name ); | |||||||||||||||||||||||||||||||||||||||||
| 2260 | 0 | foreach my $this (@param) { | |||||||||||||||||||||||||||||||||||||||||
| 2261 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 2262 | 0 | $self->{'top_container'}->set_nes_env( 'q_' . $obj_name . '_param_' . $count, $this ); | |||||||||||||||||||||||||||||||||||||||||
| 2263 | 0 | $self->{'query'}->set( $obj_name . '_param_' . $count, $this ); | |||||||||||||||||||||||||||||||||||||||||
| 2264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2265 | |||||||||||||||||||||||||||||||||||||||||||
| 2266 | 0 | my $container = nes_container->new($file); | |||||||||||||||||||||||||||||||||||||||||
| 2267 | 0 | $container->go(); | |||||||||||||||||||||||||||||||||||||||||
| 2268 | |||||||||||||||||||||||||||||||||||||||||||
| 2269 | 0 | $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 2270 | 0 | $self->{'top_container'}->del_nes_env( 'q_obj_param_' . $count ); | |||||||||||||||||||||||||||||||||||||||||
| 2271 | 0 | $self->{'query'}->del( 'obj_param_' . $count ); | |||||||||||||||||||||||||||||||||||||||||
| 2272 | 0 | foreach my $this (@param) { | |||||||||||||||||||||||||||||||||||||||||
| 2273 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 2274 | 0 | $self->{'top_container'}->del_nes_env( 'q_' . $obj_name . '_param_' . $count ); | |||||||||||||||||||||||||||||||||||||||||
| 2275 | 0 | $self->{'query'}->del( $obj_name . '_param_' . $count ); | |||||||||||||||||||||||||||||||||||||||||
| 2276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2277 | |||||||||||||||||||||||||||||||||||||||||||
| 2278 | 0 | my $out = $container->get_out(); | |||||||||||||||||||||||||||||||||||||||||
| 2279 | 0 | $container->forget(); | |||||||||||||||||||||||||||||||||||||||||
| 2280 | |||||||||||||||||||||||||||||||||||||||||||
| 2281 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 2282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2283 | |||||||||||||||||||||||||||||||||||||||||||
| 2284 | 0 | ▶ | sub replace_hash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_hash: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 2285 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2286 | 0 | my ( $code, $name_hash ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2287 | 0 | $name_hash =~ s/\s*//g; | |||||||||||||||||||||||||||||||||||||||||
| 2288 | |||||||||||||||||||||||||||||||||||||||||||
| 2289 | 0 | ▶ | if ( $name_hash =~ /$self->{'tag_field'}/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2290 | 0 | $code =~ s/\s*(.+?)\.(\S*)\s*/$self->security($self->{'tags'}{$1}{$2})/egi; | |||||||||||||||||||||||||||||||||||||||||
| 2291 | 0 | return $code; | |||||||||||||||||||||||||||||||||||||||||
| 2292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2293 | |||||||||||||||||||||||||||||||||||||||||||
| 2294 | 0 | my %hash = %{ $self->{'tags'}{$name_hash} }; | |||||||||||||||||||||||||||||||||||||||||
| 2295 | |||||||||||||||||||||||||||||||||||||||||||
| 2296 | 0 | my $out_code; | |||||||||||||||||||||||||||||||||||||||||
| 2297 | 0 | foreach my $key ( keys %hash ) { | |||||||||||||||||||||||||||||||||||||||||
| 2298 | 0 | my $tmp_code = $code; | |||||||||||||||||||||||||||||||||||||||||
| 2299 | 0 | $tmp_code =~ s/$self->{'pre_start'}\s*$self->{'tag_field'}\s*($name_hash\._name)\s*$self->{'pre_end'}/$self->security($key)/egi; | |||||||||||||||||||||||||||||||||||||||||
| 2300 | 0 | $tmp_code =~ s/$self->{'pre_start'}\s*$self->{'tag_field'}\s*($name_hash\._value)\s*$self->{'pre_end'}/$self->security($hash{$key})/egi; | |||||||||||||||||||||||||||||||||||||||||
| 2301 | 0 | $out_code .= $tmp_code; | |||||||||||||||||||||||||||||||||||||||||
| 2302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2303 | |||||||||||||||||||||||||||||||||||||||||||
| 2304 | 0 | return $out_code; | |||||||||||||||||||||||||||||||||||||||||
| 2305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2306 | |||||||||||||||||||||||||||||||||||||||||||
| 2307 | 0 | ▶ | sub replace_nsql { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_nsql: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||
| 2308 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2309 | 0 | my ( $code, $sql ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2310 | |||||||||||||||||||||||||||||||||||||||||||
| 2311 | 0 | ▶ | return if $sql !~ /^SELECT/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2312 | |||||||||||||||||||||||||||||||||||||||||||
| 2313 | 0 | my $tmp_no_html = $self->{'security_options'}{'no_html'}; | |||||||||||||||||||||||||||||||||||||||||
| 2314 | 0 | my $tmp_no_nes = $self->{'security_options'}{'no_nes'}; | |||||||||||||||||||||||||||||||||||||||||
| 2315 | 0 | my $tmp_no_br = $self->{'security_options'}{'no_br'}; | |||||||||||||||||||||||||||||||||||||||||
| 2316 | 0 | my $tmp_no_sql = $self->{'security_options'}{'no_sql'}; | |||||||||||||||||||||||||||||||||||||||||
| 2317 | |||||||||||||||||||||||||||||||||||||||||||
| 2318 | 0 | ▶ | if ( $sql =~ /$self->{'pre_start'}/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2319 | 0 | my $interpret = nes_interpret->new( $self->postformat($sql) ); | |||||||||||||||||||||||||||||||||||||||||
| 2320 | 0 | $interpret->{'security_options'}{'no_sql'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 2321 | 0 | $sql = $interpret->go( %{ $self->{'tags'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 2322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2323 | |||||||||||||||||||||||||||||||||||||||||||
| 2324 | 0 | my $name = $self->{'CFG'}{'DB_base'}; | |||||||||||||||||||||||||||||||||||||||||
| 2325 | 0 | my $user = $self->{'CFG'}{'DB_user'}; | |||||||||||||||||||||||||||||||||||||||||
| 2326 | 0 | my $pass = $self->{'CFG'}{'DB_pass'}; | |||||||||||||||||||||||||||||||||||||||||
| 2327 | 0 | my $driver = $self->{'CFG'}{'DB_driver'}; | |||||||||||||||||||||||||||||||||||||||||
| 2328 | 0 | my $host = $self->{'CFG'}{'DB_host'}; | |||||||||||||||||||||||||||||||||||||||||
| 2329 | 0 | my $port = $self->{'CFG'}{'DB_port'}; | |||||||||||||||||||||||||||||||||||||||||
| 2330 | |||||||||||||||||||||||||||||||||||||||||||
| 2331 | 0 | require Nes::DB; | |||||||||||||||||||||||||||||||||||||||||
| 2332 | 0 | my $obj_name = $self->{'query'}->{'q'}{'obj_param_0'}; | |||||||||||||||||||||||||||||||||||||||||
| 2333 | 0 | ▶ | if ( $self->{'container'}->{'type'} eq 'nsql' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2334 | 0 | ▶ | $name = $self->{'query'}->{'q'}{ $obj_name . '_param_1' } || $self->{'CFG'}{'DB_base'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'query'}{'q'}{$obj_name . '_param_1'} || $self->{'CFG'}{'DB_base'}
MC/DC0%0/2
$self->{'query'}{'q'}{$obj_name . '_param_1'} || $self->{'CFG'}{'DB_base'}
$self->{'query'}{'q'}{$obj_name . '_param_1'}
$self->{'CFG'}{'DB_base'}
Truth table0%0/3
A || B
A= $self->{'query'}{'q'}{$obj_name . '_param_1'}B= $self->{'CFG'}{'DB_base'}
| |||||||||||||||||||||||||||||||||||||||||||
| 2335 | 0 | ▶ | $user = $self->{'query'}->{'q'}{ $obj_name . '_param_2' } || $self->{'CFG'}{'DB_user'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'query'}{'q'}{$obj_name . '_param_2'} || $self->{'CFG'}{'DB_user'}
MC/DC0%0/2
$self->{'query'}{'q'}{$obj_name . '_param_2'} || $self->{'CFG'}{'DB_user'}
$self->{'query'}{'q'}{$obj_name . '_param_2'}
$self->{'CFG'}{'DB_user'}
Truth table0%0/3
A || B
A= $self->{'query'}{'q'}{$obj_name . '_param_2'}B= $self->{'CFG'}{'DB_user'}
| |||||||||||||||||||||||||||||||||||||||||||
| 2336 | 0 | ▶ | $pass = $self->{'query'}->{'q'}{ $obj_name . '_param_3' } || $self->{'CFG'}{'DB_pass'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'query'}{'q'}{$obj_name . '_param_3'} || $self->{'CFG'}{'DB_pass'}
MC/DC0%0/2
$self->{'query'}{'q'}{$obj_name . '_param_3'} || $self->{'CFG'}{'DB_pass'}
$self->{'query'}{'q'}{$obj_name . '_param_3'}
$self->{'CFG'}{'DB_pass'}
Truth table0%0/3
A || B
A= $self->{'query'}{'q'}{$obj_name . '_param_3'}B= $self->{'CFG'}{'DB_pass'}
| |||||||||||||||||||||||||||||||||||||||||||
| 2337 | 0 | ▶ | $driver = $self->{'query'}->{'q'}{ $obj_name . '_param_4' } || $self->{'CFG'}{'DB_driver'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'query'}{'q'}{$obj_name . '_param_4'} || $self->{'CFG'}{'DB_driver'}
MC/DC0%0/2
$self->{'query'}{'q'}{$obj_name . '_param_4'} || $self->{'CFG'}{'DB_driver'}
$self->{'query'}{'q'}{$obj_name . '_param_4'}
$self->{'CFG'}{'DB_driver'}
Truth table0%0/3
A || B
A= $self->{'query'}{'q'}{$obj_name . '_param_4'}B= $self->{'CFG'}{'DB_driver'}
| |||||||||||||||||||||||||||||||||||||||||||
| 2338 | 0 | ▶ | $host = $self->{'query'}->{'q'}{ $obj_name . '_param_5' } || $self->{'CFG'}{'DB_host'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'query'}{'q'}{$obj_name . '_param_5'} || $self->{'CFG'}{'DB_host'}
MC/DC0%0/2
$self->{'query'}{'q'}{$obj_name . '_param_5'} || $self->{'CFG'}{'DB_host'}
$self->{'query'}{'q'}{$obj_name . '_param_5'}
$self->{'CFG'}{'DB_host'}
Truth table0%0/3
A || B
A= $self->{'query'}{'q'}{$obj_name . '_param_5'}B= $self->{'CFG'}{'DB_host'}
| |||||||||||||||||||||||||||||||||||||||||||
| 2339 | 0 | ▶ | $port = $self->{'query'}->{'q'}{ $obj_name . '_param_6' } || $self->{'CFG'}{'DB_port'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'query'}{'q'}{$obj_name . '_param_6'} || $self->{'CFG'}{'DB_port'}
MC/DC0%0/2
$self->{'query'}{'q'}{$obj_name . '_param_6'} || $self->{'CFG'}{'DB_port'}
$self->{'query'}{'q'}{$obj_name . '_param_6'}
$self->{'CFG'}{'DB_port'}
Truth table0%0/3
A || B
A= $self->{'query'}{'q'}{$obj_name . '_param_6'}B= $self->{'CFG'}{'DB_port'}
| |||||||||||||||||||||||||||||||||||||||||||
| 2340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2341 | |||||||||||||||||||||||||||||||||||||||||||
| 2342 | 0 | my $base = Nes::DB->new( $name, $user, $pass, $driver, $host, $port ); | |||||||||||||||||||||||||||||||||||||||||
| 2343 | 0 | my @result = $base->sen_select($sql); | |||||||||||||||||||||||||||||||||||||||||
| 2344 | |||||||||||||||||||||||||||||||||||||||||||
| 2345 | 0 | $self->{'top_container'}->set_nes_env( 'DBnes_error_last_error', $base->{'errstr'} ); | |||||||||||||||||||||||||||||||||||||||||
| 2346 | 0 | $self->{'top_container'}->set_nes_env( 'DBnes_rows', $base->{'rows'} ); | |||||||||||||||||||||||||||||||||||||||||
| 2347 | |||||||||||||||||||||||||||||||||||||||||||
| 2348 | 0 | $self->{'security_options'}{'no_nes'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 2349 | 0 | $self->{'security_options'}{'no_html'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 2350 | |||||||||||||||||||||||||||||||||||||||||||
| 2351 | 0 | my $out_code; | |||||||||||||||||||||||||||||||||||||||||
| 2352 | 0 | foreach my $reg (@result) { | |||||||||||||||||||||||||||||||||||||||||
| 2353 | 0 | my $tmp_code = $code; | |||||||||||||||||||||||||||||||||||||||||
| 2354 | 0 | $tmp_code =~ s/$self->{'pre_start'}\s*$self->{'tag_field'}\s*($self->{'param_bracket'})\s*$self->{'pre_end'}/$self->replace_field($reg,'\S*',$1)/egi; | |||||||||||||||||||||||||||||||||||||||||
| 2355 | 0 | $out_code .= $tmp_code; | |||||||||||||||||||||||||||||||||||||||||
| 2356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2357 | |||||||||||||||||||||||||||||||||||||||||||
| 2358 | 0 | $self->{'security_options'}{'no_html'} = $tmp_no_html; | |||||||||||||||||||||||||||||||||||||||||
| 2359 | 0 | $self->{'security_options'}{'no_nes'} = $tmp_no_nes; | |||||||||||||||||||||||||||||||||||||||||
| 2360 | 0 | $self->{'security_options'}{'no_br'} = $tmp_no_br; | |||||||||||||||||||||||||||||||||||||||||
| 2361 | 0 | $self->{'security_options'}{'no_sql'} = $tmp_no_sql; | |||||||||||||||||||||||||||||||||||||||||
| 2362 | |||||||||||||||||||||||||||||||||||||||||||
| 2363 | 0 | return $out_code; | |||||||||||||||||||||||||||||||||||||||||
| 2364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2365 | |||||||||||||||||||||||||||||||||||||||||||
| 2366 | 0 | ▶ | sub replace_tpl { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_tpl: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2367 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2368 | 0 | my ( $code, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2369 | |||||||||||||||||||||||||||||||||||||||||||
| 2370 | 0 | my $out_code; | |||||||||||||||||||||||||||||||||||||||||
| 2371 | 0 | foreach my $reg ( @{ $self->{'tags'}{$name} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 2372 | 0 | my $tmp_code = $code; | |||||||||||||||||||||||||||||||||||||||||
| 2373 | 0 | $tmp_code =~ s/$self->{'pre_start'}\s*$self->{'tag_field'}\s*($self->{'param_bracket'})\s*$self->{'pre_end'}/$self->replace_field($reg,$name,$1)/egi; | |||||||||||||||||||||||||||||||||||||||||
| 2374 | 0 | $out_code .= $tmp_code; | |||||||||||||||||||||||||||||||||||||||||
| 2375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2376 | |||||||||||||||||||||||||||||||||||||||||||
| 2377 | 0 | return $out_code; | |||||||||||||||||||||||||||||||||||||||||
| 2378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2379 | |||||||||||||||||||||||||||||||||||||||||||
| 2380 | 0 | ▶ | sub replace_field { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_field: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2381 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2382 | 0 | my ( $reg, $name, $params ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2383 | 0 | my @param = $self->param_block($params); | |||||||||||||||||||||||||||||||||||||||||
| 2384 | |||||||||||||||||||||||||||||||||||||||||||
| 2385 | 0 | my $var = shift @param; | |||||||||||||||||||||||||||||||||||||||||
| 2386 | 0 | $var =~ s/$name\.//; | |||||||||||||||||||||||||||||||||||||||||
| 2387 | |||||||||||||||||||||||||||||||||||||||||||
| 2388 | 0 | return $self->security($reg->{$var},@param); | |||||||||||||||||||||||||||||||||||||||||
| 2389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2390 | |||||||||||||||||||||||||||||||||||||||||||
| 2391 | 0 | ▶ | sub replace_env { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_env: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 2392 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2393 | 0 | my ($var, @security_options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||||||||||||||||
| 2395 | 0 | my $tmp_no_html = $self->{'security_options'}{'no_html'}; | |||||||||||||||||||||||||||||||||||||||||
| 2396 | 0 | my $tmp_no_nes = $self->{'security_options'}{'no_nes'}; | |||||||||||||||||||||||||||||||||||||||||
| 2397 | |||||||||||||||||||||||||||||||||||||||||||
| 2398 | # comportamiento por defecto: | ||||||||||||||||||||||||||||||||||||||||||
| 2399 | 0 | ▶ | $self->{'security_options'}{'no_html'} = 1 if $var =~ /^q_/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2400 | 0 | ▶ | $self->{'security_options'}{'no_nes'} = 1 if $var =~ /^q_/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2401 | |||||||||||||||||||||||||||||||||||||||||||
| 2402 | 0 | $var = $self->security( $self->{'top_container'}->get_nes_env($var), @security_options ); | |||||||||||||||||||||||||||||||||||||||||
| 2403 | |||||||||||||||||||||||||||||||||||||||||||
| 2404 | 0 | $self->{'security_options'}{'no_html'} = $tmp_no_html; | |||||||||||||||||||||||||||||||||||||||||
| 2405 | 0 | $self->{'security_options'}{'no_nes'} = $tmp_no_nes; | |||||||||||||||||||||||||||||||||||||||||
| 2406 | |||||||||||||||||||||||||||||||||||||||||||
| 2407 | 0 | return $var; | |||||||||||||||||||||||||||||||||||||||||
| 2408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2409 | |||||||||||||||||||||||||||||||||||||||||||
| 2410 | 0 | ▶ | sub replace_plugin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace_plugin: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2411 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2412 | 0 | my ( $block, $space1, $space2 ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2413 | 0 | my ( $tag, $params, $code ) = $block =~ /$self->{'block_plugin'}/; | |||||||||||||||||||||||||||||||||||||||||
| 2414 | 0 | my $out; | |||||||||||||||||||||||||||||||||||||||||
| 2415 | 0 | my ( @register_tags ) = $self->{'register'}->get_tags(); | |||||||||||||||||||||||||||||||||||||||||
| 2416 | |||||||||||||||||||||||||||||||||||||||||||
| 2417 | 0 | foreach my $tag_plugin ( @register_tags ) { | |||||||||||||||||||||||||||||||||||||||||
| 2418 | 0 | ▶ | if ( $tag =~ /^$tag_plugin$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2419 | 0 | my $handler = $self->{'register'}->get_tag_handler($tag_plugin); | |||||||||||||||||||||||||||||||||||||||||
| 2420 | 0 | ▶ | if ( !$handler ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2421 | 0 | warn "No handler for plugin Tag: $tag_plugin "; | |||||||||||||||||||||||||||||||||||||||||
| 2422 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 2423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2424 | 0 | $out = $handler->( $code,$self->param_block($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 2425 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 2426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2428 | |||||||||||||||||||||||||||||||||||||||||||
| 2429 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 2430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2431 | |||||||||||||||||||||||||||||||||||||||||||
| 2432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2433 | |||||||||||||||||||||||||||||||||||||||||||
| 2434 | |||||||||||||||||||||||||||||||||||||||||||
| 2435 | { | ||||||||||||||||||||||||||||||||||||||||||
| 2436 | |||||||||||||||||||||||||||||||||||||||||||
| 2437 | 5 | package utl; | |||||||||||||||||||||||||||||||||||||||||
| 2438 | |||||||||||||||||||||||||||||||||||||||||||
| 2439 | 0 | ▶ | sub get_file_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_path: not called CC=3 SCAR=18.1
| |||||||||||||||||||||||||||||||||||||||||||
| 2440 | |||||||||||||||||||||||||||||||||||||||||||
| 2441 | 5 | ▶ | use FindBin qw($Bin $Script); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2442 | 0 | ▶ | my $file = $ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'} || "$Bin\\$Script"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'} || "$utl::Bin\\$utl::Script"
$ENV{"PATH_TRANSLATED"} or $ENV{"SCRIPT_FILENAME"}
MC/DC0%0/2
$ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'} || "$utl::Bin\\$utl::Script"
$ENV{"PATH_TRANSLATED"}
$ENV{"SCRIPT_FILENAME"}
Truth table0%0/3
A or B
A= $ENV{"PATH_TRANSLATED"}B= $ENV{"SCRIPT_FILENAME"}
| |||||||||||||||||||||||||||||||||||||||||||
| 2443 | |||||||||||||||||||||||||||||||||||||||||||
| 2444 | 0 | return $file; | |||||||||||||||||||||||||||||||||||||||||
| 2445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2446 | |||||||||||||||||||||||||||||||||||||||||||
| 2447 | 4 | ▶ | sub get_file_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_dir: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||||||||
| 2448 | |||||||||||||||||||||||||||||||||||||||||||
| 2449 | 5 | ▶ | use FindBin qw($Bin $Script); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2450 | 4 | ▶ | my $dir = $ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'} || "$Bin\\$Script"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'} || "$utl::Bin\\$utl::Script"
$ENV{"PATH_TRANSLATED"} or $ENV{"SCRIPT_FILENAME"}
MC/DC0%0/2
$ENV{'PATH_TRANSLATED'} || $ENV{'SCRIPT_FILENAME'} || "$utl::Bin\\$utl::Script"
$ENV{"PATH_TRANSLATED"}
$ENV{"SCRIPT_FILENAME"}
Truth table33%1/3
A or B
A= $ENV{"PATH_TRANSLATED"}B= $ENV{"SCRIPT_FILENAME"}
| |||||||||||||||||||||||||||||||||||||||||||
| 2451 | 4 | $dir =~ s/(.*)(\\|\/).*/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 2452 | |||||||||||||||||||||||||||||||||||||||||||
| 2453 | 4 | return $dir; | |||||||||||||||||||||||||||||||||||||||||
| 2454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2455 | |||||||||||||||||||||||||||||||||||||||||||
| 2456 | 4 | ▶ | sub get_root_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_root_dir: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 2457 | |||||||||||||||||||||||||||||||||||||||||||
| 2458 | 5 | ▶ | use FindBin '$Bin'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2459 | 4 | my ($root_dir) = split( "$ENV{'PATH_INFO'}", $ENV{'PATH_TRANSLATED'} ); | |||||||||||||||||||||||||||||||||||||||||
| 2460 | 4 | ▶ | my $dir = $root_dir || $Bin; # en entornos no cgi da el directorio en el que se ejecuta el script o directorio de trabajo | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$root_dir || $utl::Bin
MC/DC0%0/2
$root_dir || $utl::Bin
$root_dir
$utl::Bin
Truth table33%1/3
A || B
A= $root_dirB= $utl::Bin
| |||||||||||||||||||||||||||||||||||||||||||
| 2461 | 4 | $dir =~ s/[\/\\]$//; | |||||||||||||||||||||||||||||||||||||||||
| 2462 | |||||||||||||||||||||||||||||||||||||||||||
| 2463 | 4 | return $dir; | |||||||||||||||||||||||||||||||||||||||||
| 2464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2465 | |||||||||||||||||||||||||||||||||||||||||||
| 2466 | 0 | ▶ | sub expires { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expires: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2467 | 0 | my ($expire) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2468 | |||||||||||||||||||||||||||||||||||||||||||
| 2469 | 0 | my (@MON) = qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/; | |||||||||||||||||||||||||||||||||||||||||
| 2470 | 0 | my (@WDAY) = qw/Sun Mon Tue Wed Thu Fri Sat/; | |||||||||||||||||||||||||||||||||||||||||
| 2471 | 0 | my (%formt) = ( | |||||||||||||||||||||||||||||||||||||||||
| 2472 | 's' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 2473 | 'm' => 60, | ||||||||||||||||||||||||||||||||||||||||||
| 2474 | 'h' => 60 * 60, | ||||||||||||||||||||||||||||||||||||||||||
| 2475 | 'd' => 60 * 60 * 24, | ||||||||||||||||||||||||||||||||||||||||||
| 2476 | 'M' => 60 * 60 * 24 * 30, | ||||||||||||||||||||||||||||||||||||||||||
| 2477 | 'y' => 60 * 60 * 24 * 365 | ||||||||||||||||||||||||||||||||||||||||||
| 2478 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 2479 | |||||||||||||||||||||||||||||||||||||||||||
| 2480 | 0 | $expire =~ /(\-?\d*)(.)/; | |||||||||||||||||||||||||||||||||||||||||
| 2481 | 0 | my $second = $1; | |||||||||||||||||||||||||||||||||||||||||
| 2482 | 0 | my $factor = $2; | |||||||||||||||||||||||||||||||||||||||||
| 2483 | 0 | my $time = time + ( $second * $formt{$factor} ); | |||||||||||||||||||||||||||||||||||||||||
| 2484 | 0 | my ( $sec, $min, $hour, $mday, $mon, $year, $wday ) = gmtime($time); | |||||||||||||||||||||||||||||||||||||||||
| 2485 | 0 | $year += 1900; | |||||||||||||||||||||||||||||||||||||||||
| 2486 | |||||||||||||||||||||||||||||||||||||||||||
| 2487 | 0 | return sprintf( "%s, %02d-%s-%04d %02d:%02d:%02d GMT", $WDAY[$wday], $mday, $MON[$mon], $year, $hour, $min, $sec ); | |||||||||||||||||||||||||||||||||||||||||
| 2488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2489 | |||||||||||||||||||||||||||||||||||||||||||
| 2490 | 0 | ▶ | sub expires_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expires_time: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 2491 | 0 | my ($expire) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2492 | |||||||||||||||||||||||||||||||||||||||||||
| 2493 | 0 | my (%formt) = ( | |||||||||||||||||||||||||||||||||||||||||
| 2494 | 's' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 2495 | 'm' => 60, | ||||||||||||||||||||||||||||||||||||||||||
| 2496 | 'h' => 60 * 60, | ||||||||||||||||||||||||||||||||||||||||||
| 2497 | 'd' => 60 * 60 * 24, | ||||||||||||||||||||||||||||||||||||||||||
| 2498 | 'M' => 60 * 60 * 24 * 30, | ||||||||||||||||||||||||||||||||||||||||||
| 2499 | 'y' => 60 * 60 * 24 * 365 | ||||||||||||||||||||||||||||||||||||||||||
| 2500 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 2501 | |||||||||||||||||||||||||||||||||||||||||||
| 2502 | 0 | $expire =~ /(\-?\d*)(.)/; | |||||||||||||||||||||||||||||||||||||||||
| 2503 | 0 | ▶ | my $second = $1 || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$1 || 0
MC/DC0%0/1
$1 || 0
$1
Truth table0%0/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||
| 2504 | 0 | ▶ | my $factor = $2 || 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$2 || 's'
MC/DC0%0/1
$2 || 's'
$2
Truth table0%0/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||||||||
| 2505 | 0 | my $time = $second * $formt{$factor}; | |||||||||||||||||||||||||||||||||||||||||
| 2506 | |||||||||||||||||||||||||||||||||||||||||||
| 2507 | 0 | return $time; | |||||||||||||||||||||||||||||||||||||||||
| 2508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2509 | |||||||||||||||||||||||||||||||||||||||||||
| 2510 | 0 | ▶ | sub escape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
escape: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2511 | 0 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2512 | |||||||||||||||||||||||||||||||||||||||||||
| 2513 | 0 | $string =~ s/(.)/'%'.sprintf("%X", ord($1))/ge; | |||||||||||||||||||||||||||||||||||||||||
| 2514 | |||||||||||||||||||||||||||||||||||||||||||
| 2515 | 0 | return $string; | |||||||||||||||||||||||||||||||||||||||||
| 2516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2517 | |||||||||||||||||||||||||||||||||||||||||||
| 2518 | 0 | ▶ | sub js_escape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
js_escape: not called CC=1 SCAR=2.6
| |||||||||||||||||||||||||||||||||||||||||||
| 2519 | 0 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2520 | |||||||||||||||||||||||||||||||||||||||||||
| 2521 | 5 | ▶ | use Encode qw(encode FB_PERLQQ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2522 | 0 | $string =~ s{([\x00-\x29\x2C\x3A-\x40\x5B-\x5E\x60\x7B-\x7F])} | |||||||||||||||||||||||||||||||||||||||||
| 2523 | 0 | {'%' . uc(unpack('H2', $1))}eg; # XXX JavaScript compatible | |||||||||||||||||||||||||||||||||||||||||
| 2524 | 0 | ▶ | $string = encode( 'ascii', $string, sub { sprintf '%%u%04X', $_[0] } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2525 | |||||||||||||||||||||||||||||||||||||||||||
| 2526 | 0 | return $string; | |||||||||||||||||||||||||||||||||||||||||
| 2527 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2528 | |||||||||||||||||||||||||||||||||||||||||||
| 2529 | 0 | ▶ | sub js_unescape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
js_unescape: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2530 | 0 | my $escaped = shift; | |||||||||||||||||||||||||||||||||||||||||
| 2531 | |||||||||||||||||||||||||||||||||||||||||||
| 2532 | 0 | $escaped =~ s/%u([0-9a-f]+)/chr(hex($1))/eig; | |||||||||||||||||||||||||||||||||||||||||
| 2533 | 0 | $escaped =~ s/%([0-9a-f]{2})/chr(hex($1))/eig; | |||||||||||||||||||||||||||||||||||||||||
| 2534 | |||||||||||||||||||||||||||||||||||||||||||
| 2535 | 0 | return $escaped; | |||||||||||||||||||||||||||||||||||||||||
| 2536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2537 | |||||||||||||||||||||||||||||||||||||||||||
| 2538 | 0 | ▶ | sub quote { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2539 | 0 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2540 | |||||||||||||||||||||||||||||||||||||||||||
| 2541 | 0 | require DBI; | |||||||||||||||||||||||||||||||||||||||||
| 2542 | |||||||||||||||||||||||||||||||||||||||||||
| 2543 | 0 | return DBD::_::db->quote($value); | |||||||||||||||||||||||||||||||||||||||||
| 2544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2545 | |||||||||||||||||||||||||||||||||||||||||||
| 2546 | 0 | ▶ | sub no_html { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_html: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2547 | 0 | my ( $value, @yes_tag ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2548 | |||||||||||||||||||||||||||||||||||||||||||
| 2549 | 0 | ▶ | return if !$value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2550 | |||||||||||||||||||||||||||||||||||||||||||
| 2551 | 0 | my $tags = ''; | |||||||||||||||||||||||||||||||||||||||||
| 2552 | 0 | foreach my $tag (@yes_tag) { | |||||||||||||||||||||||||||||||||||||||||
| 2553 | 0 | $tags .= '\/?'.$tag.'\W|'; | |||||||||||||||||||||||||||||||||||||||||
| 2554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2555 | 0 | $tags =~ s/\|$//; | |||||||||||||||||||||||||||||||||||||||||
| 2556 | |||||||||||||||||||||||||||||||||||||||||||
| 2557 | 0 | ▶ | if (!$tags) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2558 | 0 | $value =~ s/\</</sg; | |||||||||||||||||||||||||||||||||||||||||
| 2559 | 0 | $value =~ s/\>/>/sg; | |||||||||||||||||||||||||||||||||||||||||
| 2560 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 2561 | 0 | ▶ | while ( $value =~ s/\<((?!$tags)[^\>\<]*)\>/<$1>/sig ) {} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2563 | |||||||||||||||||||||||||||||||||||||||||||
| 2564 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 2565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2566 | |||||||||||||||||||||||||||||||||||||||||||
| 2567 | 0 | ▶ | sub no_nes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_nes: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 2568 | 0 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2569 | |||||||||||||||||||||||||||||||||||||||||||
| 2570 | 0 | ▶ | return if !$value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2571 | |||||||||||||||||||||||||||||||||||||||||||
| 2572 | 0 | my $tags = qr/ | |||||||||||||||||||||||||||||||||||||||||
| 2573 | \{: | ||||||||||||||||||||||||||||||||||||||||||
| 2574 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 2575 | \s* | ||||||||||||||||||||||||||||||||||||||||||
| 2576 | (\$|\*|\~|sql|\%|inc|\#|\&|nes) | ||||||||||||||||||||||||||||||||||||||||||
| 2577 | (.+?) | ||||||||||||||||||||||||||||||||||||||||||
| 2578 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 2579 | :\} | ||||||||||||||||||||||||||||||||||||||||||
| 2580 | /six; | ||||||||||||||||||||||||||||||||||||||||||
| 2581 | |||||||||||||||||||||||||||||||||||||||||||
| 2582 | 0 | ▶ | while ( $value =~ s/$tags/{:$1:}/go ) {} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2583 | |||||||||||||||||||||||||||||||||||||||||||
| 2584 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 2585 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2586 | |||||||||||||||||||||||||||||||||||||||||||
| 2587 | 0 | ▶ | sub no_nes_remove { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_nes_remove: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 2588 | 0 | my ($data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2589 | |||||||||||||||||||||||||||||||||||||||||||
| 2590 | 0 | my $start = '(\{|\%7B)(\:|\%3A)'; | |||||||||||||||||||||||||||||||||||||||||
| 2591 | 0 | my $end = '(?:\:|\%3A)(?:\%7D|\})'; | |||||||||||||||||||||||||||||||||||||||||
| 2592 | |||||||||||||||||||||||||||||||||||||||||||
| 2593 | 0 | $$data =~ s/$start/{_/gis; | |||||||||||||||||||||||||||||||||||||||||
| 2594 | 0 | $$data =~ s/$end/_}/gis; | |||||||||||||||||||||||||||||||||||||||||
| 2595 | |||||||||||||||||||||||||||||||||||||||||||
| 2596 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 2597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2598 | |||||||||||||||||||||||||||||||||||||||||||
| 2599 | 0 | ▶ | sub cleanup { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 2600 | 0 | my (@vars) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2601 | |||||||||||||||||||||||||||||||||||||||||||
| 2602 | 0 | ▶ | if ( $MOD_PERL2 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2603 | 0 | require Apache2::RequestUtil; | |||||||||||||||||||||||||||||||||||||||||
| 2604 | 0 | require Apache2::RequestIO; | |||||||||||||||||||||||||||||||||||||||||
| 2605 | 0 | require APR::Pool; | |||||||||||||||||||||||||||||||||||||||||
| 2606 | 0 | Apache2::RequestUtil->request->pool->cleanup_register(\&utl::cleanup_callback, @vars); | |||||||||||||||||||||||||||||||||||||||||
| 2607 | |||||||||||||||||||||||||||||||||||||||||||
| 2608 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2609 | |||||||||||||||||||||||||||||||||||||||||||
| 2610 | 0 | ▶ | if ( $MOD_PERL1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2611 | 0 | require Apache; | |||||||||||||||||||||||||||||||||||||||||
| 2612 | 0 | Apache->request->register_cleanup(\&utl::cleanup_callback, @vars); | |||||||||||||||||||||||||||||||||||||||||
| 2613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2614 | |||||||||||||||||||||||||||||||||||||||||||
| 2615 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 2616 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2617 | |||||||||||||||||||||||||||||||||||||||||||
| 2618 | 0 | ▶ | sub cleanup_callback { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup_callback: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 2619 | 0 | my (@vars) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 2620 | |||||||||||||||||||||||||||||||||||||||||||
| 2621 | 0 | foreach my $var (@vars) { | |||||||||||||||||||||||||||||||||||||||||
| 2622 | 0 | my $ref = ref $var; | |||||||||||||||||||||||||||||||||||||||||
| 2623 | 0 | ▶ | undef $$var if $ref eq 'SCALAR' || $ref eq 'REF' ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ref eq "SCALAR" or $ref eq "REF"
MC/DC0%0/2
$ref eq "SCALAR" or $ref eq "REF"
$ref eq "SCALAR"
$ref eq "REF"
Truth table0%0/3
A or B
A= $ref eq "SCALAR"B= $ref eq "REF"
| |||||||||||||||||||||||||||||||||||||||||||
| 2624 | 0 | ▶ | undef %$var if $ref eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2625 | 0 | ▶ | undef @$var if $ref eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 2626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2627 | |||||||||||||||||||||||||||||||||||||||||||
| 2628 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 2629 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2630 | |||||||||||||||||||||||||||||||||||||||||||
| 2631 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2632 | |||||||||||||||||||||||||||||||||||||||||||
| 2633 | |||||||||||||||||||||||||||||||||||||||||||
| 2634 | |||||||||||||||||||||||||||||||||||||||||||
| 2635 | |||||||||||||||||||||||||||||||||||||||||||
| 2636 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||