
darian
Deleted
Mar 20, 2000, 11:27 PM
Post #5 of 5
(372 views)
|
Why would you test an open statement with an if statement? I would put: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> use CGI qw(:cgi); use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/HTML", "\n\n"; print "<HTML>\n<HEAD>\n<TITLE>The Daily Misleader</TITLE>\n</HEAD>\n"; print "<BODY>\n<H1>The Daily Misleader</H1>\n<BLOCKQUOTE>\n"; $first_line =1; $story = $ENV{'PATH_TRANSLATED'}; if (story =~ /\.\./) { print "<P>Paths that include .. are a security risk.</P> \n; } else { open (INPUT, "<$story") or die("$!"); while (<INPUT> ) { chomp; if ($first_line) { print "<H1>", $_, "</H1>\n"; $first_line=0; } elsif ($_ eq "") { print "<P>\n"; } else { print $_, "\n"; } } } print "<HR WIDTH=70%>\n"; print "<P>Back to the <A HREF=\"home.html\">home page</A>.</P>\n"; print "<P>Copyright© 2000, My News Service.</P>\n";</pre><HR></BLOCKQUOTE> [This message has been edited by darian (edited 03-21-2000).]
|