Mojo::DOM58::Entities - Escape or unescape HTML entities in strings
use Mojo::DOM58::Entities qw(html_escape html_unescape); my $str = 'foo & bar'; $str = html_unescape $str; # "foo & bar" $str = html_escape $str; # "foo & bar"
Mojo::DOM58::Entities contains functions for escaping and unescaping HTML entities for Mojo::DOM58, based on functions from Mojo::Util. All functions are exported on demand.
my $str = html_attr_unescape $escaped;
Same as "html_unescape", but handles special rules from the HTML Living Standard for HTML attributes.
# "foo=bar<est=baz" html_attr_unescape 'foo=bar<est=baz'; # "foo=bar<est=baz" html_attr_unescape 'foo=bar<est=baz';
my $escaped = html_escape $str;
Escape unsafe characters &, <, >, ", and ' in string.
&
<
>
"
'
html_escape '<div>'; # "<div>"
my $str = html_unescape $escaped;
Unescape all HTML entities in string, according to the HTML Living Standard.
html_unescape '<div>'; # "<div>"
Report issues related to the format of this distribution or Perl 5.8 support to the public bugtracker. Any other issues should be reported directly to the upstream Mojolicious issue tracker.
Dan Book <dbook@cpan.org>
Code and tests adapted from Mojo::Util, a set of utilities by the Mojolicious team.
Copyright (c) 2008-2016 Sebastian Riedel and others.
Copyright (c) 2016 Dan Book for adaptation to standalone format.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
HTML::Entities
To install Mojo::DOM58, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::DOM58
CPAN shell
perl -MCPAN -e shell install Mojo::DOM58
For more information on module installation, please visit the detailed CPAN module installation guide.