croak "Unsupported type: " . $options->{type} unless $options->{type} =~ m/^(?:html|js|json)$/;
# The "template" argument must be a string or a reference to one.
+ $template = ${ $template } if ((ref($template) || '') eq 'REF') && (ref(${ $template }) eq 'SL::Presenter::EscapedText');
croak "Unsupported 'template' reference type: " . ref($template) if ref($template) && (ref($template) !~ m/^(?:SCALAR|SL::Presenter::EscapedText)$/);
# If all output is turned off then don't output the header either.
croak "Unsupported type: " . $options->{type} unless $options->{type} =~ m/^(?:html|js|json)$/;
# The "template" argument must be a string or a reference to one.
+ $template = ${ $template } if ((ref($template) || '') eq 'REF') && (ref(${ $template }) eq 'SL::Presenter::EscapedText');
croak "Unsupported 'template' reference type: " . ref($template) if ref($template) && (ref($template) !~ m/^(?:SCALAR|SL::Presenter::EscapedText)$/);
# Look for the file given by $template if $template is not a reference.
# If no processing is requested then return the content.
if (!$options->{process}) {
# If $template is a reference then don't try to read a file.
- return SL::Presenter::EscapedText->new(text => ${ $template }, is_escaped => 1) if ref $template;
+ my $ref = ref $template;
+ return $template if $ref eq 'SL::Presenter::EscapedText';
+ return SL::Presenter::EscapedText->new(text => ${ $template }, is_escaped => 1) if $ref eq 'SCALAR';
# Otherwise return the file's content.
my $file = IO::File->new($source, "r") || croak("Template file ${source} could not be read");