Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2001 08:18:38 +0200
From:      Rogier Steehouder <r.j.s@gmx.net>
To:        Andre` Niel Cameron <AndreC@Axxs.net>
Cc:        free bsd <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Perl Help Please
Message-ID:  <20011019081838.A616@localhost>
In-Reply-To: <077d01c15838$2a6af4f0$a50410ac@olmct.net>; from AndreC@Axxs.net on Thu, Oct 18, 2001 at 08:51:19PM -0400
References:  <077d01c15838$2a6af4f0$a50410ac@olmct.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18-10-2001 20:51 (-0400), Andre` Niel Cameron wrote:
> #!/bin/perl
> print "Content-type: text/html\n\n";
> @COMMAND= ("Login", "Fight");

Okay so far.

> &Display_Html("templates/login.html");
> 
> $check= $ENV{QUERY_STRING};
> 
> if ($check == $COMMAND[0]) {
> &Display_Html("templates/test.html");
> }

I'd make this:

if ($ENV{'QUERY_STRING'} eq $COMMAND[0]) {
	&Display_Html("templates/test.html");
} else {
	&Display_Html("templates/login.html");
}

What you're doing is send the login page to the client and then, if the
test succeeds, add the test page to that page. Remember, everything you
send to stdout will be send to the web browser.

> sub Display_Html {
> $data_file = $_[0];
> open(HTML, $data_file) || die("Could not open file!");
> @Html_template=<HTML>;
> close(HTML);
> print "@Html_template";
> @Html_template= ();
> }

Remove @Html_template. It's eating memory.

while (<HTML>) { print; }

Or slightly more readable:

while ($line = <HTML>) {
	print($line);
}

With kind regards, Rogier Steehouder

-- 
                          ___                          _
-O_\                                                  //
 | /               Rogier Steehouder                 //\
/ \                  r.j.s@gmx.net                  //  \
  <---------------------- 25m ---------------------->

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011019081838.A616>