http://qs1969.pair.com?node_id=781989

gctaylor1 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I've got 10-20 text files that I want to include in one HTML file so a user would see one big scrollable set of data in the browser(and be able to use the browser search feature). As far as I can tell there isn't an HTML method/tag to include external text files like this. I was thinking about using Perl to directly manipulate the HTML file but that will be messy and error prone because not only would I need to append the text files in to one big HTML file but might have to remove sections as well. The text files are generated by another process and there's no guarantee of the file being present, the size, or content being predictable.

I've looked at HTML::Pager and HTML::Template and have been trying to get the latter working without success to open a filehandle and then display the contents. I'll be using CGI too because I want to get user input.

Am I even close or is there a better way to do this?

#template2.pl c:\perl\bin\perl.exe use warnings; use strict; use CGI; use HTML::Template; my $template = HTML::Template->new(filename => 'c:\inetpub\wwwroot\cgi +-bin\template2.tmpl'); open(FH, 'c:\temp\output.txt') || die("Can't open output.txt: $!"); my $ioref = \*FH; $template->param(FILE => "$ioref"); $template->param(PATH => 'yellow brick road'); print "Content-Type: text/html\n\n", $template->output
#template2.tmpl <html> <head><title>Test Template</title> <body> Contents of file are <TMPL_VAR NAME=FILE> <p> Path is set to <TMPL_VAR NAME=PATH> </body> </html>
This doesn't work, and instead prints
Contents of file are GLOB(0x152ab4c) Path is set to yellow brick road
Thank-you for your time.