Valiant::Filter::HtmlEscape - HTML escaping on strings
package Local::Test::User; use Moo; use Valiant::Filters; has 'name' => (is=>'ro', required=>1); filters name => ( html_escape => 1, ); my $user = Local::Test::User->new(name=>'<a>john</a>'); print $user->name; # '<a>john</a>'
This is a very simple filter that takes no paramters and HTML escapes any incoming strings. Useful to help with stuff like cross scripting attacks, etc.
Please be aware that the regexp for this might be too simple for truly hardening your code; please review.
Valiant, Valiant::Filter, Valiant::Validator::Filter.
See Valiant
To install Valiant, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Valiant
CPAN shell
perl -MCPAN -e shell install Valiant
For more information on module installation, please visit the detailed CPAN module installation guide.