[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Dynamically including a static page


On Thu, 17 Jul 2003, Jeffrey wrote:

> I have also considered opening the file and reading it into
> a variable then using a <TMPL_VAR> to get the content into the page,
> but reading in a file line by line every time the page is requested
> seems a bit extraneous.   Anyone have suggestions on a better method
> to make this happen?

I have no idea what you mean by 'extraneous' in this context, but
there's no reason to read it line-by-line.  You could read it in all
at once:

  {
     local $/ = undef; # slurp mode
     open(my $fh, 'file.txt') or die $!;   
     $template->param(file => <$fh>);
     close($fh) or die $!;
  }

-sam


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.