NAME

t/09-caching-precluded.t

OBJECTIVE

In HTML::Template v2.7, it was in principle possible to pass to the constructor an option which called for caching even in cases where the template source was not a file.

$template = HTML::Template->new(
    type   => 'scalarref',
    source => \$template_string,
    cache => 1,
);

The documentation indicated it was not possible to cache results coming from a filehandle, string or array, but the module itself did not handle a violation of this rule cleanly. If you attempted to construct an HTML::Template object such as the example above, you would get three distinct and confusing error messages.

Phalanx has modified HTML::Template::new() to preclude the possibility of any of the six cache options having a true value if the template source is a filehandle, string or array. The constructor now does additional error-checking and, if a violation is found, the program dies and an appropriate error message is emitted via croak and analyzed.