Re: simple problem w/ opening files

From: Herr Hardy (schaumfestiger_at_gmx.de)
Date: 05/17/04


Date: Mon, 17 May 2004 10:16:23 +0200

On Sun, 16 May 2004 12:27:37 -0700, "Mat W" <werbs@cox.net> wrote:

><head><title>$mytitle</title></head>
>
>Now, in the script there are times when i need to print this file. What i
>want to do is first set the variables, then open the file and print the html
>contents.

You could try something like this:
Make your Html-Template to be some Perl-Code

test.html:

# START_FILE
print << "EOF_TEMPLATE";
    <head><title>$mytitle</title></head>
EOF_TEMPLATE
1;
#EOF

>For example:
>$mytitle = "TEST";
>open (FILEIN, "./pages/test.html");
>@contents = <FILEIN>;
>close (FILEIN);
>print @contents.

Include this with Perl's 'require' to be executed, not just read

$mytitle = "TEST";
require "/path/to/templates/test.html";

There are some things to be carefully observed (e.g. masking:
email\@mydomain.com instead of email@mydomain.com) and maybe/ surely
some others... but to me it seems like a simple and fast way to solve
a little problem.

Ciao Hardy



Relevant Pages

  • Re: passing options to a shell script
    ... barnard wrote: ... im trying to write a script that will accept two options out of a list ... an attempt to pass more than one option from the first set an error is ... the same applies to the second set of options. ...
    (comp.unix.bsd.freebsd.misc)
  • Javascript problem in Firefox
    ... if the user's screensize is ... this as a single piece of script, with only the first opening script ... first set of material goes here ... second set of material goes here inside table ...
    (comp.lang.javascript)
  • passing options to a shell script
    ... im trying to write a script that will accept two options out of a list ... What i am trying to accomplish is, when any one of the first set of ... an attempt to pass more than one option from the first set an error is ... the same applies to the second set of options. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: where to put apache in startup order
    ... Believe I was setting up a start script for Big Brother. ... startup script as httpd in the init.d directory. ... The first set of numbers I believe list the run levels the script should ... last number is the kill order. ...
    (Fedora)