The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Valiant::HTML::Util::View - Default view for Formbuilder

SYNOPSIS

For internal use only

DESCRIPTION

When using the Valiant HTML packages (Valiant::HTML::FormBuilder, Valiant::HTML::FormTags and the rest) a default view is required to provide methods for escaping strings as well as potentially providing data. This way we escape strings compatible with your view template system. If you are using these packages outside a view or template system then we will use this package to provide those methods. Or if your template does not do escaping (such as Template::Toolkit). You can use this as an example of how to write an adaptor to make things like Valiant::HTML::FormBuilder escape strings such that your system works with them.

METHODS

This class defines the following instance methods.

raw

given a string return a single tagged object which is marked as safe for display. Do not do any HTML escaping on the string. This is used when you want to pass strings straight to display and that you know is safe. Be careful with this to avoid HTML injection attacks.

safe

given a string return a single tagged object which is marked as safe for display. First HTML escape the string as safe unless its already been done (no double escaping).

safe_concat

Same as safe but instead works an an array of strings (or mix of strings and safe string objects) and concatenates them all into one big safe marked string.

escape_html

Given a string return string that has been HTML escaped.

read_attribute_for_html

Given an attribute name return the value that the view has defined for it.

attribute_exists_for_html

Given an attribute name return true if the view has defined it.

SEE ALSO

Valiant, Valiant::HTML::SafeString, Valiant::HTML::FormBuilder

AUTHOR

See Valiant

COPYRIGHT & LICENSE

See Valiant