-   Programming (
-   -   Perl: Read a html file and output it... (

JoeBleaux 04-02-2009 11:28 PM

Perl: Read a html file and output it...
I'm trying to write a perl script that (at the heart of it) will read an html file one character at a time and send it out via apache.

Meaning a url of:

would read test.html (one character at a time) and send it to Apache to be displayed as a normal web page...

So far I have:



use CGI qw(:param);

my $page = param('page');

print "Content-type: text/plain; charset=iso-8859-1\n\n";
open FILE, "$page" or die $!;

while($ch = getc(FILE)) {
        print $ch;
 close (FILE);

The page is spit out the web server but, it is displayed EXACTLY (as text) and not as html (meaning the HTML code is visible).

It's late, I'm tired, any ideas?

theNbomr 04-03-2009 01:00 AM

Shouldn't the content-type header refer to 'text/html'?
--- rod.

j-ray 04-03-2009 04:54 AM

...corected... got you wrong. It's the content-type as theNomr said already

JoeBleaux 04-03-2009 07:54 AM

DOH!!!! Like I said, it was late and I was tired.

I don't care what those BSD guys say about you Linux guys, you're okay by me!

All times are GMT -5. The time now is 01:14 PM.