Re: perl - sending an existing file to browser.
by "peter newton" <c-newton(at)ihug.co.nz>
|
Date: |
Tue, 5 Jun 2001 00:15:48 +1200 |
To: |
<hwg-techniques(at)hwg.org> |
References: |
norton |
|
todo: View
Thread,
Original
|
|
Thanks for the input,
OK, One of my goals is specifically NOT to read the file in first, to
minimise unnecessary cpu overheads. but to simply select an html file which
already exists and does not need altering and send it.
Thanks Peter
----- Original Message -----
From: "Jason K. Chapman" <theguild(at)interserv.com>
> open(HTML,"<$filename");
> my @lines = <HTML>;
> close(HTML);
>
> print "Content-Type: text/html\n\n";
> foreach $line (@lines) {
> print $line;
> }
>
> Or......
>
> $url = "http://$domain_name/$filename";
> print "Location: $url\n\n";
>
> The advantage of reading the file in and printing it out is that you get
> the opportunity to do any necessary s/// template substitutions.
>
> As always, with Perl, there are a few dozen other ways to do it. Which
one
> you use depends on the specifics of the task.
>
> Jason K. Chapman
> --
> THE HERETIC, a cyber thriller by Jason K. Chapman.
> Online edition at <http://www.happyhacker.org/heretic/>. Softcover,
> ISBN 1-929925-38-7. Latest news at <http://www.jasonkchapman.com>
>
>
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA