|
|
| No such thing as a small change | |
| PerlMonks |
Can't open file using Perl as CGIby timtowtdi (Acolyte) |
| on May 19, 2008 at 21:40 UTC ( #687472=perlquestion: print w/ replies, xml ) | Need Help?? |
|
timtowtdi has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am struggling with opening files using Perl as CGI.
I just want to show the contents of a file (just in the testing fase) I use this simple code:
#!/usr/bin/perl
use strict;
print "Content-type: text/plain\n\n";
open (INFILE, '<', 'textfile.txt');
while (<INFILE>)
{
print "$_\n";
}
close (INFILE);
The trouble is: I don't get an error-message, but I also don't see the contents of textfile.txt. If I try to print other stuff, for example: I add the line: print "Hello\n"; under the line where I close INFILE, it will return the string Hello in my browser.Even if the file textfile.txt doesn't exist, it won't return an error-message. Not in my browser and not in my logfile on my server. If I make other mistakes, for example, something with the syntax, it will return error-messages in both my browser and the error-logs of Apache. Any of you Monks an idea? :) Thanx in advance, Tim Server running: Gentoo Linux with Apache 2.2.8 with mod_perl/2.0.3-dev Perl/v5.8.8
The great mistake is to anticipate the outcome of the engagement; Let nature take it's course, and your tools will strike at the right moment.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||