This protects you from Cross-Site-Scripting attacks and handles the double quote issue.
Not quite, you're missing the html filter, e.g.:
use Template; my $tt = Template->new(); my $soap = ' "foo" <bar> & '; $tt->process(\<<END, {soap=>$soap}) || die $tt->error(); <html> <input type="text" name="mytext" value="[% soap %]"/> </html> END $tt->process(\<<END, {soap=>$soap}) || die $tt->error(); <html> <input type="text" name="mytext" value="[% soap | html %]"/> </html> END __END__ <html> <input type="text" name="mytext" value=" "foo" <bar> & "/> </html> <html> <input type="text" name="mytext" value=" "foo" <bar> + &amp; "/> </html>
In reply to Re^2: Escaping double quotes in complete document
by haukex
in thread Escaping double quotes in complete document
by MeinName
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |