The Wakaba and Kareha support thread, part 3 (535)

435 Name: Anonymous : 2014-02-04 21:04 ID:Heaven [Del]

>>434
Okay I just tried looking through the compile_template function myself and I think this should take care of it.

if(!$safemode) {
if($closing) {
if($name eq 'if') { $code.='}' }
elsif($name eq 'loop') { $code.='$$_=$__ov{$_} for(keys %__ov);}}' }
}
else {
if($name eq 'var') { $code.='$res.=eval{'.$args.'};' }
elsif($name eq 'const') { my $const=eval $args; $const=~s/(['\\])/\\$1/g; $code.='$res.=\''.$const.'\';' }
elsif($name eq 'if') { $code.='if(eval{'.$args.'}){' }
elsif($name eq 'loop')
{ $code.='my $__a=eval{'.$args.'};if($__a){for(@$__a){my %__v=%{$_};my %__ov;for(keys %__v){$__ov{$_}=$$_;$$_=$__v{$_};}' }
}
}
else {
if(($name eq 'var') and ($args =~ /^\$[a-zA-Z]+$/)) {
$code .= '$res .= eval{' . $args . '};'
}
}

Any obvious gaping holes?

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: