简体   繁体   中英

HTML Escaping for perl

I have a html code assigned to a perl variable

1) my $content;

$content .= qq~<input type='hidden' name='Email' value='~.$ARGS{Email}.qq~' />~;

Another one is this:

2) <form name="email_form" id="email_form" class="form-inline <% $ARGS{Email} ? 'hide' : '' %>" >

How to do mason substitution for these?

For the second one, is this right?

<form name="email_form" id="email_form" class="form-inline <% $ARGS{Email} | h ? 'hide' : '' %>" >

Use CGI's escapeHTML or some equivalent

use CGI qw(escapeHTML);

$content .= qq~<input type='hidden' name='Email' value='~. escapeHTML($ARGS{Email}) .qq~' />~;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM