+
+ } elsif (ref($template) eq 'SCALAR') {
+ # Normal scalar reference: hand over to Template
+ $source = $template;
+
+ } else {
+ # Instance of SL::Presenter::EscapedText. Get reference to its content.
+ $source = \$template->{text};
+ }
+
+ # 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;
+
+ # Otherwise return the file's content.
+ my $file = IO::File->new($source, "r") || croak("Template file ${source} could not be read");
+ my $content = do { local $/ = ''; <$file> };
+ $file->close;
+
+ return SL::Presenter::EscapedText->new(text => $content, is_escaped => 1);