Matt S Trout > HTML-String > HTML::String::TT::Directive

Download:
HTML-String-1.000006.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Source  

NAME ^

HTML::String::TT::Directive - Template::Directive overrides to forcibly escape HTML strings

SYNOPSIS ^

This is not user serviceable, and is documented only for your edification.

Please use HTML::String::TT as this module could change, be renamed, or if I figure out a better way of implementing the functionality disappear entirely at any moment.

METHODS ^

template

We override this top-level method in order to pretend two things to the perl subroutine definition that TT has generated - firstly,

  package HTML::String::TT::_TMPL;

to ensure that no packages marked to be ignored are the current one when the template code is executed. Secondly,

  use HTML::String::Overload { ignore => { ... } };

where the ... contains a list of TT internal packages to ignore so that things actually work. This list is not duplicated here since it may also change without warning.

Additionally, the hashref option to HTML::String::Overload is not documented there since I'm not yet convinced that's a public API either.

text

Due to a perl bug (https://rt.perl.org/rt3/Ticket/Display.html?id=49594) we overload this method to change

  "<foo>\n<bar>"

into

  "<foo>"."\n"."<bar>"

since any string containing a backslash escape doesn't get marked as HTML. Since we don't want to escape things that backslash escapes are normally used for, this isn't really a problem for us.

textblock

For no reason I can comprehend at all, Template::Directive's textblock method calls &text instead of using a method call so we have to override this as well.

AUTHORS ^

See HTML::String for authors.

COPYRIGHT AND LICENSE ^

See HTML::String for the copyright and license.

syntax highlighting: