Here you go (and yes, I'm absopositivilutely sure data.txt exists)...
I have this data file:
This is the first line of the datafile.
This is the second line of the datafile.
This is the third line of the datafile.
This is the last line of the datafile.
I also have this cgi file:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
&print_return_page_top;
if (open (FILENAME, "data.txt"))
{
$line = <FILENAME>;
while ($line ne "")
{
print "$line<BR>";
$line = <FILENAME>;
}
}
else {
print "Booger<br>";
}
&print_return_page_bottom;
##################################
sub print_return_page_top
{
print <<RETURN_PAGE_TOP;
<HTML>
<HEAD>
<TITLE>This Reads And Prints A File</TITLE>
</HEAD>
<BODY BGCOLOR="#COCOCO" TEXT="#000000" LINK="#0000FF" VLINK="#9966CC"
+ALINK="#FF0000">
<P>Hello,
RETURN_PAGE_TOP
}
###################################
##################################
sub print_return_page_bottom
{
print <<RETURN_PAGE_BOTTOM;
</BODY>
</HTML>
RETURN_PAGE_BOTTOM
}
###################################
When I run the cgi file, the script does run. It prints an html page in IE and it says "Hello, Booger". I can't figure out why it's not opening the file. They are both in the same directory. In fact they're both in c:\Inetpub\wwwroot\CGI-BIN
In Internet Services Manager, the files are read and writebale. ISUSR has Guest access (I tried it with Admin access, same result). Nothing seems to work. A little more info:
Win2K Pro
IIS 5.0
ActivePerl (installed after starting IIS)
Running it all locally on localhost. I only have this capability, don't have another machine to try from.
Help me before I give up on perl again. I don't want to. I like perl, I really do.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.