How can I prevent Mojolicious from dumping character data?

I am trying to send HTML to a template in Mojolicious and find that html is being replaced with safe lines somewhere along the way.

$self->stash(portalHeaderHtml => "<html>"); 

becomes

  &lt;html&gt; 

In source

Template:

 <%= $portalHeaderHtml %> 

How can I say that it displays HTML and does not replace tags?

+6
source share
1 answer

Mojolicious::Guides::Rendering suggests using == to disable character escaping.

An optional equal sign can be used to turn off the shielding of the characters <,>, &, "and" as a result of Perl expressions, by default, to prevent XSS attacks against your application.

 <%== '<p>test</p>' %> 

Take care.

+11
source

All Articles